Osy

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 5

1. WHAT IS PROCESS SCHEDULING?

• Imagine a CPU (the brain of your computer) as a worker in a factory.


There are many tasks (processes) that need to be done, but only one
task can be handled at a time. Process scheduling is the system that
decides which task the CPU (worker) will do next, and for how long.
SCHEDULING QUEUES

• Think of queues like waiting lines. In a computer system, there are different
queues where processes (tasks) wait for their turn.
• Job Queue: This is like a waiting room. All new tasks are placed here when
they enter the system. They are waiting to be allowed to start.
• Ready Queue: These are tasks that are ready to be worked on by the CPU. It’s
like a line of customers waiting to be served at a counter. The CPU will pick
tasks from this queue and work on them.
• Device Queue (I/O Queue): If a task needs to wait for something like reading
from a disk or printing, it goes to a special line called the device queue.
SCHEDULER

• A scheduler is like a manager who decides which task should be done next. There are
three types of schedulers:
• Long-Term Scheduler: Think of this scheduler as the admission officer at a university. It
decides which students (tasks) are allowed into the system and when. Its job is to control
how many students (tasks) are actively learning (being processed by the CPU).
• Short-Term Scheduler: This is like a teacher in the classroom, deciding which student
(task) should answer a question (be given the CPU) at any given moment. It chooses a task
quickly and frequently because it controls the CPU.
• Medium-Term Scheduler: Sometimes, the classroom gets too full. The medium-term
scheduler is like a teacher who temporarily sends a student (task) out to the hallway
(memory) until there’s more space in the room.
CONTEXT SWITCHING

• Context switching is when the CPU stops working on one task and
starts working on another.
• Imagine the CPU (worker) is solving one problem, but before it finishes,
it has to stop and start solving a new problem. Before it stops, it needs
to write down everything about the first problem (save the process
state). Then, when the new problem is solved, it can return to the first
one and continue where it left off by looking at its notes (restoring the
process state).

You might also like