Posts

Showing posts from August, 2021

Memory Management

Address Binding :  a mapping from one address space to another Binding of instructions and data to memory addresses can be done at ____________ a) Compile time b) Load time c) Execution time If the process can be moved during its execution from one memory segment to another, then binding must be   delayed until run time. Dynamic loading : is  loading a routine only when it is called The advantage of dynamic loading is:  An unused routine is never loaded The idea of overlays is to ___________ a) data that are needed at any given time b) enable a process to be larger than the amount of memory allocated to it c) keep in memory only those instructions The  programmer  must design and program the overlay structure. The  Memory manager   swaps processes in and out of the memory. If a higher priority process arrives and wants service, the memory manager can swap out the lower priority process to execute the higher priority process . When the higher prio...

Deadlock

A deadlock situation on a resource can arise if and only if all of the following conditions occur simultaneously in a system: Mutual exclusion:   At least one resource must be held in a non-shareable mode . Otherwise, the processes would not be prevented from using the resource when necessary. If another process requests that resource ( non – shareable resource ), the requesting process must be delayed until the resource has been released. A system is in a safe state if  the system can allocate resources to each process in some order and still avoid a deadlock. The following condition is required for a deadlock to be possible: a) mutual exclusion b) a process may hold allocated resources while awaiting the assignment of other resources c) no resource can be forcibly removed from a process holding it The circular wait condition can be prevented by  defining a linear ordering of resource types. Banker’s algorithm  is the deadlock avoidance algorithm . The drawback...

Process Synchronization

  A cooperating process can be affected by other processes executing in the system. When several processes access the same data concurrently and the outcome of the execution depends on the particular order in which access takes place is called race condition . If a process is executing in its critical section, then no other processes can be executed in their critical section. This condition is called Mutual Exclusion . Semaphore is a synchronization tool. Semaphore is a mechanism which synchronizes or controls access of threads on critical resources. There are two types of semaphores i) Binary Semaphore ii) Counting Semaphore. A semaphore is a shared integer variable that can not drop below zero . In binary semaphore, if the value of the semaphore variable is zero that means there is a process that uses a critical resource and no other process can access the same critical resource until it is released.  Mutual exclusion can be provided by both mutex locks and binary semaphore...

Processes

Those systems which allow more than one process execution at a time, are called multiprocessing systems. Uniprocessing means only one processor. In Operating Systems, each process has its own address space which contains code, data , stack and heap segments or sections. Each process also has a list of files which is opened by the process as well as all pending alarms, signals and various signal handlers. In UNIX , a new process is created by fork() system call. fork() system call returns a process ID which is generally the process id of the child process created. A process can be terminated normally by completing its task or because of fatal error or killed by another process or forcefully killed by a user . When the process completes its task without any error then it exits normally . The process may exit abnormally because of the occurrence of fatal error while it is running. The process can be killed or terminated forcefully by another process . Interprocess Communication (IPC...