Os Faq
Os Faq
Operating system controls and coordinates the use of the hardware among the various
applications programs for various uses. Operating system acts as resource allocator and
manager. Since there are many possibly conflicting requests for resources the operating
system must decide which requests are allocated resources to operating the computer
system efficiently and fairly. Also operating system is control program which controls the
user programs to prevent errors and improper use of the computer. It is especially
concerned with the operation and control of I/O devices.
2) Explain briefly about, processor, assembler, compiler, loader, linker and the functions
executed by them.
Processor:--A processor is the part a computer system that executes instructions .It is also
called a CPU
Linker: -- Linker performs the linking of libraries with the object code to make the object
code into an executable machine code.
A real time process is a process that must respond to the events within a certain time
period. A real time operating system is an operating system that can run real time
processes successfully
4) What is the difference between Hard and Soft real-time systems?
A hard real-time system guarantees that critical tasks complete on time. This goal
requires that all delays in the system be bounded from the retrieval of the stored data to
the time that it takes the operating system to finish any request made of it.
A soft real time system where a critical real-time task gets priority over other tasks and
retains that priority until it completes. As in hard real time systems kernel delays need to
be bounded
A real time operating system has well defined fixed time constraints. Process must be
done within the defined constraints or the system will fail. An example is the operating
system for a flight control computer or an advanced jet airplane. Often used as a control
device in a dedicated application such as controlling scientific experiments, medical
imaging systems, industrial control systems, and some display systems.Real-Time
systems may be either hard or soft real-time.
Hard real-time:
-> Secondary storage limited or absent, data stored in short term memory, or read-only
memory (ROM)
-> Conflicts with time-sharing systems, not supported by general-purpose operating
systems.
Soft real-time:
->Limited utility in industrial control of robotics
->Useful in applications (multimedia, virtual reality) requiring advanced operating-
system features.
6) What is hard disk and what is its purpose?
Hard disk is the secondary storage device, which holds the data in bulk, and it holds the
data on the magnetic medium of the disk.
Hard disks have a hard platter that holds the magnetic medium, the magnetic medium can
be easily erased and rewritten, and a typical desktop machine will have a hard disk with a
capacity of between 10 and 40 gigabytes. Data is stored onto the disk in the form of files.
A virtual memory is hardware technique where the system appears to have more memory
that it actually does. This is done by time-sharing, the physical memory and storage parts
of the memory one disk when they are not actively being used.
8) What are the difference phases of software development or software life cycle?
Ans
Cache memory is random access memory (RAM) that a computer microprocessor can
access more quickly than it can access regular RAM. As the microprocessor processes
data, it looks first in the cache memory and if it finds the data there (from a previous
reading of data), it does not have to do the more time-consuming reading of data from
larger memory.
->Interrupt transfers control to the interrupt service routine generally, through the
interrupt vector, which contains the addresses of all the service routines.
->Interrupt architecture must save the address of the interrupted instruction.
->Incoming interrupts are disabled while another interrupt is being processed to prevent a
lost interrupt.
->A trap is a software-generated interrupt caused either by an error or a user request.
->An operating system is interrupt driven.
Main memory: – only large storage media that the CPU can access directly.
Secondary storage: – extension of main memory that provides large nonvolatile storage
capacity.
23) While running DOS on a PC, which command would be used to duplicate the entire
diskette?
diskcopy
24) Java Thread States
2
Deadlock is a situation where a group
one of the other becomes unblocked.
T
->Dispatcher module g
1) Switching context
2) Switching to user mode
3
2
Micro-Kernel: A micro-kernel is a minimal operating system that performs only the
essentia
o
Monolithic: A monolithic operating system is one wh
a
3
A
3
Multi progra
timesharing.
It
The concept of multiprogramming is that the operating system keeps several jobs in
memory simultaneously. The operating system selects a job from the job pool and starts
executing a job, when that job needs to w
o
Multi tasking: Multitasking is the logical extension of multiprogramming .The concept
of multitasking is quite similar to multiprogramming but difference is that the switching
between jobs occurs so frequently that the userscan interact with each program while it is
running. This concept is also known as time-sharing systems. A time-shared operating
syst
ti
Multi threading: An application typically is implemented as a separate process with
several threads of control. In some situations a single application may be required to
perform several similar tasks for example a web server accepts client requests for web
pages, images, sound, and so forth. A busy web server may have several of clients
concurrently accessing it. If the web server ran as a traditional single-threaded process, it
would be able to serviconly one client
b
So it is efficient to have one process that contains multiple threads to serve the same
purpose. This approach would multithread the web-server process, the server would
create a separate thread that would listen for client requests whe
the request. So to get the advantages like responsiveness, Resource sharin
a
Semiconductor memories are of two types: RAM (random access memory) and ROM
(read only memory).
RAM is a read/write memory. Information can be w
I
ROM is permanent type memory. Its contents are not lost when power supply goes off.
the us
a ROM.Its contents are decided by the manufacturer and written at
P
3
When a thread is created the threads does not require any new resources to execute the
thread shares the resources like memory of the process to which they belong to. The
benefit of code sha
h
Where as if a new process creation is very heavyweight because it always requires new
address space to be created and even if they share the memory then the inter process
communication is expensive when compared to the communication between the threads.
34) Describe the actions taken by thread library to context switch between user level
threads?
The thread library function performs the following actions to context switch between user
level threads
a) Copy all live registers to Thread control Block (TCB)
b) Restore the state of the thread to run next i.e (copy the values of live registers from
(TCB) to registers)
c) Move to the next thread to execute
Consider any system where people use some kind of resources and compete for them.
The non-computer examples for preemptive scheduling the traffic on the single lane road
if there is emergency or there is an ambulance on the road the other vehicles give path to
the vehicles that are in need. The example for preemptive scheduling is people standing
in queue for tickets.
36) Compare Linux credit based algorithm with other scheduling algorithms?
For the conventional time –shared processes, Linux uses a prioritized, credit-based
algorithm. Each process possesses a certain number of scheduling credits; when a new
task must be chosen to run, the process with most credits is selected. Every time that a
timer interrupt occurs, the currently running process loses one credit; when its credits
reaches zero, it is suspended and another process is chosen.
If no runnable processes have any credits, then Linux performs a recrediting operation,
adding credits to every process in the system (rather than just to the runnable ones),
according to the following rule:
Linux’s real-time scheduling is soft-real time rather than hard-real time. The scheduler
offers strict guarantees about the relative priorities of real-time processes, but the kernel
does not offer any guarantees about how quickly a real-time process will be scheduled
once that process becomes runnable.
Thus the Linux uses different scheduling classes for time-shared and real-time processes.
Starvation: Starvation is a resource management problem where a process does not get
the resources it needs for a long time because the resources are being allocated to other
processes.
Hard real-time systems – required to complete a critical task within a guaranteed amount
of time.
Soft real-time computing – requires that critical processes receive priority over less
fortunate ones.
Process Termination:
->Abort all deadlocked processes.
->Abort one process at a time until the deadlock cycle is eliminated.
->In which order should we choose to abort?
1) Priority of the process.
2) How long process has computed, and how much longer to completion.
3) Resources the process has used.
4) Resources process needs to complete.
5) How many processes will need to be terminated?
6) Is process interactive or batch?
Resource Preemption:
->Selecting a victim – minimize cost.
->Rollback – return to some safe state, restart process for that state.
->Starvation – same process may always be picked as victim, include number of rollback
in cost factor.
Address binding of instructions and data to memory addresses can happen at three
different stages
1) Compile time: If memory location known a priori, absolute code can be generated; must
recompile code if starting location changes.
2) Load time: Must generate relocatable code if memory location is not known at compile
time.
3) Execution time: Binding delayed until run time if the process can be moved during its
execution from one memory segment to another. Need hardware support for address
maps (e.g., base and limit registers).
->Hardware device that maps virtual to physical address. In MMU scheme, the value
time it is sent to memory. logicalreal
-
Dynamic Loading:
->Routine is not loaded until it is called
->Better memory-space utilization; unused routine is never loaded.
->Useful when large amounts of code are needed to handle infrequently occurring cases.
->No special support from the operating system is required implemented through
program design.
Dynamic Linking:
->Linking postponed until execution time.
->Small piece of code, stub, used to locate the appropriate memory-resident library
routine.
->Stub replaces itself with the address of the routine, and executes the routine.
->Operating system needed to check if routine is in processes’ memory address.
->Dynamic linking is particularly useful for libraries.
Overlays:
->Keep in memory only those instructions and data that are needed at any given time.
->Needed when process is larger than amount of memory allocated to it.
->Implemented by user, no special support needed from operating system, programming
design of overlay structure is complex.
First-fit and best-fit are better than worst-fit in terms of speed and storage utilization.
Fragmentation occurs in a dynamic memory allocation system when many of the free
blocks are too small to satisfy any request.
Page fault interrupt: A page fault interrupt occurs when a memory reference is made to a
page that is not in memory.
The present bit in the page table entry will be found to be off by the virtual memory
hardware and it will signal an interrupt.
Trashing: The problem of many page faults occurring in a short time, called “page
thrashing,”
52) Under what circumstances do page faults occur? Describe the actions taken by the
operating system when a page fault occurs?
A page fault occurs when an access to a page that has not been brought into main
memory takes place. The operating system verifies the memory access, aborting the
program if it is invalid. If it is valid, a free frame is located and I/O is requested to read
the needed page into the free frame. Upon completion of I/O, the process table and page
table are updated and the instruction is restarted.
53) What is the cause of thrashing? How does the system detect thrashing? Once it
detects thrashing, what can the system do to eliminate this problem?
Recall that paging is implemented by breaking up an address into a page and offset
number. It is most efficient to break the address into X page bits and Y offset bits, rather
than perform arithmetic on the address to calculate the page number and offset. Because
each bit position represents a power of 2, splitting an address between bits results in a
page size that is a power of 2.
55) On a system with paging, a process cannot access memory that it does not own; why?
How could the operating system allow access to other memory? Why should it or should
it not?
An address on a paging system is a logical page number and an offset. The physical page
is found by searching a table based on the logical page number to produce a physical
page number. Because the operating system controls the contents of this table, it can limit
a process to accessing only those physical pages allocated to the process. There is no way
for a process to refer to a page it does not own because the page will not be in the page
table. To allow such access, an operating system simply needs to allow entries for non-
process memory to be added to the process’s page table. This is useful when two or more
processes need to exchange data—they just read and write to the same physical addresses
(which may be at varying logical addresses). This makes for very efficient interprocess
communication.