Operating System PDF
Operating System PDF
Operating System PDF
27 2019 21:32
1. The main function of the command interpreter is = to get and execute the next user-specified command.
2. Operating system, the resource management can be done via = both time and space division multiplexing
3. Dtrace: Facility which dynamically adds probes to a running system, both in user processes and in the kernel.
4. The OS X has hybrid kernel.
Processes
5. Uni-processing systems: The systems which allows only one process execution at a time.
6. In operating system, each process has its own address space and global variables + open files + pending alarms, signals and
signal handlers.
7. FORK: system call creates to the new process in UNIX.
8. Ready state of a process: when process is scheduled to run after some execution.
9. A process stack does not contain: PID of child process.
10. Which system call returns the process identifier of a terminated child : wait.
11. The address of the next instruction to be executed by the current process is provided by the: Program counter
12. A Process Control Block(PCB) does contains: Code + Stack + data.
13. The Process Control Block is: Data Structure.
14. The entry of all the PCBs of the current processes is in: Process Table.
15. The degree of multiprogramming is: the number of processes in memory.
Process Scheduling Queues
16. When the process issues an I/O request : It is placed in an I/O queue.
17. What is a long-term scheduler= It selects which process has to be brought into the ready queue.
18. If all processes I/O bound, the ready queue will almost always be EMPTY and the Short term Scheduler will have a LITTLE to
do.
19. What is a medium-term scheduler = It selects which process to remove from memory by swapping.
20. What is a short-term scheduler : It selects which process has to be executed next and allocates CPU.
21. The primary distinction between the short term scheduler and the long term scheduler is : The frequency of their execution.
22. The only state transition that is initiated by the user process itself is : block.
23. In a time-sharing operating system, when the time slot given to a process is completed, the process goes from the running state to
the : Ready state.
24. In a multiprogramming environment : more than one process resides in the memory.
25. Suppose that a process is in “Blocked” state waiting for some I/O service. When the service is completed, it goes to the : Ready
state.
26. The context of a process in the PCB of a process does not contain : context switch time.
27. Which of the following does not interrupt a running process ? Scheduler process.
Process Synchronization:
28. Which process can be affected by other processes executing in the system? cooperating process.
29. When several processes access the same data concurrently and the outcome of the execution depends on the particular order in
which the access takes place, is called race condition.
30. If a process is executing in its critical section, then no other processes can be executing in their critical section. This condition is
called mutual exclusion.
31. A semaphore is a shared integer variable that can not drop below zero.
32. Mutual exclusion can be provided by the both mutex locks and binary semaphores.
33. Priority inversion = When high priority task is indirectly preempted by medium priority task effectively inverting the relative
priority of the two tasks.
34. Process synchronization can be done on both hardware and software level.
35. A monitor is a module that encapsulates = shared data structures + procedures that operate on shared data structure +
synchronization between concurrent procedure invocation.
36. To enable a process to wait within the monitor, a condition variable must be declared as condition.
37. In UNIX, the return value for the fork system call is ZERO for the child process and NON ZERO INTEGER for the parent
process.
38. The child process completes execution, but the parent keeps executing, then the child process is known as : Zombie.
39. Inter process communication : allows processes to communicate and synchronize their actions without using the same address
space.
40. Message passing system allows processes to : communicate with one another without resorting to shared data.
41. An IPC facility provides at least two operations :receive & send message.
42. Messages sent by a process : can be fixed or variable sized.
43. The link between two processes P and Q to send and receive messages is called : communication link.
44. In indirect communication between processes P and Q : there is a mailbox to help communication between P and Q.
45. In the non-blocking send : the sending process sends the message and resumes operation.
46. In the Zero capacity queue : the sender blocks until the receiver receives the message.
47. The Zero Capacity queue : is referred to as a message system with no buffering.
48. Bounded capacity and Unbounded capacity queues are referred to as : Automatic buffering.
49. remote method invocation : allows a thread to invoke a method on a remote object.
102.
I/O Devices:
1. Each device controller has a local buffer.
2. CPU moves data from/to main memory to/from local buffers.
3. I/O is from the device to local buffer of controller.
4. Device controller informs CPU that it has finished its operation by causing an interrupt.
Interrupt Handling:
1. The operating system preserves the state of the CPU by storing registers and the program counter.
2. Determines which type of interrupt has occurred:
a. Polling.
b. Vectored interrupt system
3. Separate segments of code determine what action should be taken for each type of interrupt.
Process scheduling: Removal of the running process from the CPU + the selection of another process on the basis of a particular
strategy.
Multiplexing: A multiprogramming technique used- by OS to allow more than one process to be loaded into the executable
memory at a time and the loaded process to shares the CPU.
Process Scheduling Queues
The OS maintains all PCBs in Process Scheduling Queues. The OS maintains a separate queue for each of the process states
and PCBs of all processes in the same execution state are placed in the same queue. When the state of a process is changed, its
PCB is unlinked from its current queue and moved to its new state queue.
Process States :
1. Running:
2. Not Running: Not running process are kept in queue, waiting for their turn. Dispatcher is used to select a process and get it
executed by CPU. Context Switches uses dispatcher.
Schedulers: Special system software + to select jobs to be submitted into system ( Job Queue) and which process will run. 3 types
are:
1. Long-Term Scheduler (LTS): Job scheduler. Admits programs to system ( From Job que to Ready que i.e Memory) for CPU
Scheduling. Primary Objective : Balanced mix jobs - I/O bound + Processor Bounds. Time- Sharing OS do not have LTS.
When it is needed: When a process changes the state from new to ready.
2. Short-Term Scheduler: Or Dispatchers: CPU Scheduler. Objective: Increase system performance. It changes state from
ready to running. It allocates CPU to process which is ready. Dispatchers= make the decision of which process to execute
next. Short-term schedulers are faster than long-term schedulers.
3. Medium-Term Scheduler: Swapping. Removes process from memory. Reduces degree of multiprogramming. MTS handles
swapped out process. Part of time sharing system.
Swapping : A running process may become suspended if it makes an I/O request. So, Suspended process moved into secondary
storage
Context Switch:
A mechanism to store and restore the state or context of a CPU in Process Control block PCB , so that a process execution
can be resumed from the same point at a later time. It enables multiple processes to share a single CPU. Its an essential part of a
multitasking operating system features.
When the scheduler switches the CPU from executing one process to execute another, the state from the current running process
is stored into the process control block. After this, the state for the process to run next is loaded from its own PCB and used to
set the PC, registers, etc. At that point, the second process can start executing.
What is it?
Integer Variable which is used in mutual exclusive manner for various concurrent cooperative
process to achieve synchronization.
Why it is used?
To Prevent the Race condition. Race condition occurs when = we sync different process OR Run
multiple process simultaneously, specially cooperative process ( processes which have something in
common).
Advantages of Semaphores:
1. Semaphores allow only one process into the critical section. They follow the mutual exclusion principle
strictly and are much more efficient than some other methods of synchronization.
2. There is no resource wastage because of busy waiting in semaphores as processor time is not wasted
unnecessarily to check if a condition is fulfilled to allow a process to access the critical section.
3. Semaphores are implemented in the machine independent code of the microkernel. So they are machine
independent
Disadvantages of Semaphores:
1. Semaphores are complicated so the wait and signal operations must be implemented in the correct order
to prevent deadlocks.
2. Semaphores are impractical for last scale use as their use leads to loss of modularity. This happens because
the wait and signal operations prevent the creation of a structured layout for the system.
3. Semaphores may lead to a priority inversion where low priority processes may access the critical section
first and high priority processes later.
Fragmentation:
As processes are loaded and removed from memory, the free memory space is broken into little pieces. It
happens after sometimes that processes cannot be allocated to memory blocks considering their small size and
memory blocks remains unused. This problem is known as Fragmentation.
External fragmentation can be reduced by compaction or shuffle memory contents to place all
free memory together in one large block. To make compaction feasible, relocation should be
dynamic.
2 Internal fragmentation
Memory block assigned to process is bigger. Some portion of memory is left unused, as it
cannot be used by another process.
The internal fragmentation can be reduced by effectively assigning the smallest partition but
large enough for the process.