Professional Documents
Culture Documents
SERVICES
Program execution
OS handle many kinds of activities from user programs to system programs like
printer spooler, name servers, file server, etc. Each of these activities is
encapsulated as a process. A process includes the complete execution context
(code to execute, data to manipulate, registers, OS resources in use).
I/O Operation
An I/O subsystem comprises of I/O devices and their corresponding driver software. Drivers hide the peculiarities of
specific hardware devices from the users. An Operating System manages the communication between user and device
drivers. I/O operation means read or write operation with any file or any specific I/O device. Operating system
provides the access to the required I/O device when required.
In case of distributed systems which are a collection of processors that do not share memory, peripheral devices, or
a clock, the operating system manages communications between all the processes. Multiple processes communicate
with one another through communication lines in the network.
The OS handles routing and connection strategies, and the problems of contention and security.
Protection refers to a mechanism or a way to control the access of programs, processes, or users to the resources
defined by a computer system. Following are the major activities of an operating system with respect to protection.
• Process control: end, abort, create, terminate, allocate and free memory.
• File management: create, open, close, delete, read file etc.
• Device management
• Information maintenance
• Communication
Q5. What is Process Control Blocks?
While creating a process the operating system performs several operations. To identify these process, it must identify
each process, hence it assigns a process identification number (PID) to each process. As the operating system supports
multi-programming, it needs to keep track of the all the processes. For this task,
the process control block (PCB) is used to track the process’s execution status.
Each block of memory contains information about the process state, program
counter, stack pointer, status of opened files, scheduling algorithms, etc. All
these information is required and must be saved when the process is switched
from one state to another. When the process made transitions from one state to
another, the operating system must update information in the process’s PCB.
A process control block (PCB) contains information about the process, i.e.
registers, quantum, priority, etc. The process table is an array of PCB’s, that
means logically contains a PCB for all of the current processes in the system.
• Pointer: It is a stack pointer which is required to be saved when the process is switched from one state to another to
retain the current position of the process.
• Process state: It stores the respective state of the process.
• Process number: Every process is assigned with a unique id is known as processed which stores the process identifier.
• Program counter: It stores the counter which contains the address of the next instruction that is to be executed for the
process.
• Register: These are the CPU registers which includes: accumulator, base, registers and general-purpose registers.
• Memory limits: This field contains the information about memory management system used by operating system. This
may include the page tables, segment tables etc.
• Open files list: This information includes the list of files opened for a process.
• CPU utilization - Ideally the CPU would be busy 100% of the time, so as to waste 0 CPU cycles. On a real system CPU
usage should range from 40% (lightly loaded) to 90% (heavily loaded.)
• Throughput - Number of processes completed per unit time. May range from 10 / second to 1 / hour depending on
the specific processes.
• Turnaround time - Time required for a particular process to complete, from submission time to completion. (Wall
clock time.)
• Waiting time - How much time processes spend in the ready queue waiting their turn to get on the CPU.
• (Load average - The average number of processes sitting in the ready queue waiting their turn to get into the CPU.
Reported in 1-minute, 5-minute, and 15-minute averages by "uptime" and "who".)
• Response time - The time taken in an interactive program from the issuance of a command to the commence of a
response to that command.
In general, one wants to optimize the average value of a criteria (Maximize CPU utilization and throughput and minimize all
the others.) However sometimes one wants to do something different, such as to minimize the maximum response time.
Sometimes it is most desirable to minimize the variance of a criteria than the actual value. I.e. users are more accepting of
a consistent predictable system than an inconsistent one, even if it is a little bit slower.
Q7. Explain the scheduling algorithms? Preemptive or Non- Preemptive?
CPU scheduling is a process which allows one process to use the CPU while the execution of another process is on
hold (in waiting state) due to unavailability of any resource like I/O etc, thereby making full use of CPU. The aim of
CPU scheduling is to make the system efficient, fast and fair.
Whenever the CPU becomes idle, the operating system must select one of the processes in the ready queue to be
executed. The selection process is carried out by the short-term scheduler (or CPU scheduler). The scheduler selects
from among the processes in memory that are ready to execute, and allocates the CPU to one of them.
1. Non-Preemptive Scheduling
Under non-preemptive scheduling, once the CPU has been allocated to a process, the process keeps the CPU until it
releases the CPU either by terminating or by switching to the waiting state. This scheduling method is used by the
Microsoft Windows 3.1 and by the Apple Macintosh operating systems. It is the only method that can be used on
certain hardware platforms, because It does not require the special hardware(for example: a timer) needed for
preemptive scheduling.
2. Preemptive Scheduling
In this type of Scheduling, the tasks are usually assigned with priorities. At times it is necessary to run a certain task
that has a higher priority before another task although it is running. Therefore, the running task is interrupted for
some time and resumed later when the priority task has finished its execution.
Scheduling Algorithms
• First Come First Serve(FCFS) Scheduling (Non- Preemptive)
• Shortest-Job-First(SJF) Scheduling
• Priority Scheduling (Preemptive)
• Round Robin(RR) Scheduling (Preemptive)
• Multilevel Queue Scheduling
• Multilevel Feedback Queue Scheduling
In Preemptive Shortest Job First Scheduling, jobs are put into ready queue as they arrive, but as a process with short burst
time arrives, the existing process is preempted.
3. Priority Scheduling
• Priority is assigned for each process.
• Process with highest priority is executed first and so on.
• Processes with same priority are executed in FCFS manner.
• Priority can be decided based on memory requirements, time requirements or any other resource requirement.