OS Concept Related To PM
OS Concept Related To PM
A blocked process cannot be scheduled even if CPU is free, whereas ready process
can be scheduled if CPU is free.
Process Scheduling
• While scheduling various processes, the operating system has to choose a set of
objectives to be achieved. Some of the objectives are listed below:
1. Fairness
2. Good throughput
3. Good CPU utilization channel link :
https://www.youtube.com/c/ComputerScienceAcademy7
4. Low turnaround time
5. Low waiting time
6. Good response time
• Some of these objectives are conflicting to each other.
• Fairness refers to being Fair to every user in terms of CPU time.
• Throughput refers to the total productive work done by all the users put together.
• CPU utilization is the fraction of the time that the CPU is busy.
• If time slice is very small, the context switches will be more frequent.
• Hence CPU will be busy with operating system than that of user processes,
• i.e. throughput will be low, but CPU utilization will be high.
Process Scheduling
• Turnaround time is the elapsed time between time a program or job is submitted
and the time when it is completed.
• Waiting time is the time a job spends waiting in the queue of the newly
implemented processes for the operating system to allocate resources to it before
commencing its execution.
• The waiting is necessary due to competition from other jobs/processes.
• Response time is the time to respond with an answer or result to a question or an
event.
• It depends on degree of multiprogramming, efficiency of hardware and policy of
operating system to allocate resources.
• The response time is extremely important for on-line, or real time systems.
Priority :
• The concept of priority is important since many processes are competing to each
other for resources like CPU time and memory.
• The priority can be global (external) or local (internal).
1. The external priority
• The external priority is specified by user externally at the time of initiating a
process.
• Even during execution it can be changed.
• If user does not specify priority, then default priority is assigned.
• For urgent jobs; high priority can be assigned.
2. The internal priority
• The internal priority is specified by Operating system internally.
• The internal priority is based on calculation of current state of process.
• For example, each user, while firing a process, can be forced to also specify the
expected time that the process is likely to take for completion.
• The operating system can then set internal priority which is highest for shortest job.
• Here we get two advantages.
• One shortest jobs, are finished faster and second, at any given time the number of
processes competing CPU will decrease.
• But if small jobs keeps coming on, large jobs may suffer from indefinite
postponement.
• This can be avoided by setting external high priority to those important large jobs.
• The operating system calculates a resultant priority based on both external and
internal priorities.
3. The Purchase priority
• In commercial data centers where each user pays for the time used, normally
higher priority processes are charged at higher rate to prevent each user from
firing his job at highest priority known as purchase priority.
• Some operating systems do not operate on concept of priority, but instead they
have a fixed time slice for each process.
• Time slice : It’s the small portion of time given to each user to execute process.
Multi-tasking
• A task can be defined as an asynchronous code path within a process.
• A process can consist of multiple tasks, which can run simultaneously.
• In the same way that an multiuser operating system supports multiple processes at
the same time.
• The multiple tasks should be able to run concurrently within a process.
• Multitasking allows programmer flexibility and improves CPU utilization,
• consider a process consisting of two tasks.
• if task 0 is blocked, instead of blocking entire process,
Task 0 : Read a Record the operating system will find out whether task 1 can be
Process a Record. scheduled.
Task 0 end. • When both the tasks are blocked, only then the entire
Task 1 : Write a Record. process is blocked.
Task 1 end • Again even if one task is ready, the process can be
moved to ready list and then scheduled, this reduces
the overheads of context switching.
Time sharing
• The concept of time sharing was demonstrated as early as 1960.
• They provide Interactive use of computer.
• It uses CPU scheduling and multiprogramming to provide each user with a small
portion of time-shared computer.
• Each user has a separate program in memory.
• When the program executes, it executes for only short time before it either finishes
or needs to perform I/O.
• The operating system will rapidly switch the CPU to the program of some other user.
• A time shared operating system allows many users to simultaneously share the
Computer.
• Each action or command in time shared system tends to be short, only a Little CPU
time is needed for each user.
• As the system rapidly switches from one user to another, user are given impression
that they have their own computer, while actually one computer is shared among
many users.