03 02 Processes Part 2 — Transcript
Full transcript
- 0:08[Music]
- 0:21all right so the next thing would be the
- 0:23process scheduling
- 0:25or the cpu scheduling okay
- 0:27so process scheduler selects among
- 0:30available processes
- 0:32for the next execution of the cpu or on
- 0:34the cpu core so the goal here is to
- 0:37maximize the cpu use
- 0:39in other terms we have to keep the cpu
- 0:41as busy as possible so we always want to
- 0:44get a hundred percent of cpu utilization
- 0:47here and
- 0:48quickly switch processes onto the cpu
- 0:51core
- 0:52so the two main objectives of process
- 0:54scheduling systems first are
- 0:57to keep the cpu busy at all times and
- 1:00second
- 1:01deliver acceptable response times for
- 1:04all the program particularly for
- 1:06interactive ones
- 1:08right so i'll repeat
- 1:10there are two objectives or main
- 1:12objectives of process scheduling
- 1:15so the first one is we have to keep the
- 1:18cpu as busy as possible okay keep the
- 1:21cpu busy at all times
- 1:23and deliver acceptable response
- 1:26for all the programs particularly for
- 1:28interactive ones
- 1:30all right so the process scheduler must
- 1:32meet these objectives by implementing
- 1:34suitable policies for swapping processes
- 1:36in and out of the cpu
- 1:39okay
- 1:40so
- 1:41note that these objectives can be
- 1:44conflicting in particular
- 1:46every time the system steps into a swap
- 1:48process
- 1:49it takes up time on the cpu to do so
- 1:52which thereby lost from doing any useful
- 1:56productive work
- 1:58okay
- 1:59so aside from that the process scheduler
- 2:02maintains scheduling cues of a process
- 2:05so you've got the ready queues and the
- 2:07weighting cues okay so what's the
- 2:09difference between these two
- 2:10when you see a ridicule these are set of
- 2:13all processes residing in the main
- 2:15memory
- 2:16ready and waiting to be executed
- 2:19okay
- 2:20and when you say weight queue
- 2:22these are set of processes waiting for
- 2:24an event
- 2:25to occur for example an i o
- 2:29right so processes migrate from among
- 2:32the various queues depending upon the
- 2:35state of the process
- 2:39okay
- 2:41so i have here the ready and waiting
- 2:43queues okay so sometimes when the
- 2:46process is preempted okay so it will be
- 2:49going back to the ram
- 2:51okay so ready and waiting for
- 2:54the next execution time
- 2:56so all processes are basically stored in
- 2:59the job queue
- 3:00okay or process queue
- 3:02okay so
- 3:04next would be
- 3:06process is in the ready state
- 3:08they are placed in the ready queue
- 3:11right so processors waiting for a device
- 3:15to become available to deliver data are
- 3:17placed in the device queues
- 3:20so we have a lot of views here
- 3:22these are generally a separate device
- 3:25for queue for each of the device there
- 3:28so other queues are also be created
- 3:31and used as needed
- 3:35all right
- 3:37okay
- 3:38so next would be the representation of a
- 3:41process scheduling
- 3:44okay
- 3:44so for the schedulers we have what you
- 3:47call
- 3:48a long-term scheduler
- 3:50this is a typical batch of system
- 3:53or a very heavily loaded system it runs
- 3:56infrequently
- 3:57such as when one process and selecting
- 4:00one more to be loaded
- 4:02in from a disk in its place
- 4:04and can afford to take the time to
- 4:07implement intelligent
- 4:09and advanced cpu scheduling algorithm
- 4:13okay so that's long-term scheduler
- 4:15we also have a short-term scheduler
- 4:17another term for that is cpu scheduler
- 4:21okay so the cpu scheduler runs very
- 4:24frequently
- 4:25on the order of 100 milliseconds
- 4:28and must be very quickly swap one
- 4:30process out of the cpu
- 4:32and swap in another one
- 4:35so some systems are also employ a medium
- 4:38term scheduler
- 4:39so when the system loads gets high
- 4:42this scheduler will swap one or more
- 4:44processes out of the ready queue
- 4:47for a few seconds so in order to allow
- 4:49smaller faster jobs to finish
- 4:52so and clear the system
- 4:54so next would be an efficient scheduling
- 4:57system
- 4:58will be select or will select a good
- 5:01process mix of the cpu bound process and
- 5:05an i o bound process
- 5:07okay
- 5:08now take a look at the cpu scheduling
- 5:10here so
- 5:11whenever you run an application okay so
- 5:14basically
- 5:15that application will be placed on the
- 5:18reticule so rediq that means the process
- 5:21is now on the ram
- 5:23ready for the execution okay it already
- 5:26has the resources needed maybe for
- 5:28execution
- 5:30so on the red state it will be forwarded
- 5:32to the cpu for execution
- 5:34this processes are executed by the cpu
- 5:37one at the time
- 5:39all right so one at a time so it's a
- 5:41matter of milliseconds
- 5:43all right now if the process burst time
- 5:46okay so let's say burst time here
- 5:48okay burst time is the amount of time
- 5:50needed by the process to complete the
- 5:52execution so for instance
- 5:55that process has already served
- 5:58the first time so that means
- 6:00the process state would be terminated
- 6:03okay
- 6:05now on the cpu if the process is
- 6:07currently executed it can be preempted
- 6:11so we say preempted
- 6:12during the execution it can be pulled
- 6:15out from the cpu
- 6:17and if it is not yet done it has to fall
- 6:19in line back again to the reticule
- 6:23now what would be that instances
- 6:26where in
- 6:27the process can be preempted from the
- 6:29cpu execution so these are the following
- 6:32so there might be an i o request coming
- 6:34from the keyboard
- 6:36all right
- 6:37so
- 6:38that would lead to an i o weight queue
- 6:41you've got an i o there so the process
- 6:43will be
- 6:44on going back to the reticule
- 6:47or maybe you are using a round robin cpu
- 6:50scheduling and the time slice
- 6:52has expired so when you say when you say
- 6:55time slice
- 6:57this is similar to the term quantum
- 7:00okay and quantum is the amount of time
- 7:02given to a process
- 7:04to stay in the cpu for execution
- 7:07all right so we call it time slice next
- 7:11another instance that the process can be
- 7:13preempted from the executes on on the
- 7:15cpu would be
- 7:16there is a child process that needs to
- 7:18be executed
- 7:20and when the child termination
- 7:22wait you
- 7:23for that process so the child will be
- 7:26terminated and again
- 7:28that process will be going back to the
- 7:30ridicule for the next execution time
- 7:34okay
- 7:35and the last one would be
- 7:37the wait for an interrupt here
- 7:39so there might be an interrupt during
- 7:41the execution of the process that's why
- 7:44it was preempted and therefore
- 7:46placed
- 7:47into the reticule
- 7:49all right
- 7:50so that's how process works inside the
- 7:53cpu
- 7:54between the memory or the ram and the
- 7:57cpu
- 8:01all right
- 8:02next let's talk about the cpu switch
- 8:04from one process to another
- 8:07okay so take note that the cpu can
- 8:10execute one job at a time for example we
- 8:13have two processes here
- 8:15namely p0 and p1 it could be any
- 8:18applications on your computer let's say
- 8:20this is microsoft word here for p0 and
- 8:23p1 is for powerpoint
- 8:25okay
- 8:26so what happened here and what happened
- 8:28here is that
- 8:29for example at the current time or at
- 8:31time zero okay process zero is being
- 8:34executed
- 8:35okay so because of the interrupt or
- 8:38system call okay so p0 will be stored or
- 8:42save the state into the pcb
- 8:44for process zero take note that each
- 8:47process has their own process control
- 8:49block
- 8:51all right
- 8:52so what will happen is okay
- 8:55so if there is an interrupt here
- 8:57there might be the instance or an
- 8:59instance where in the process is idle
- 9:01waiting for another chance of execution
- 9:04so on this area here the process is in
- 9:09the waiting queue
- 9:11or in the ready queue so that means they
- 9:13are ideal
- 9:15okay
- 9:15now if one process is idle there might
- 9:18be another process that is currently
- 9:20being executed
- 9:22okay
- 9:22and when you say cpu switch from one
- 9:25process to the other okay so take note
- 9:28that the cpu is processing
- 9:30one process or one job at a time
- 9:33so if the process is not able to finish
- 9:36the execution or if the burst time
- 9:39has not been served
- 9:40and it has been
- 9:42preempted
- 9:44okay so that's the time the cpu is
- 9:46executing another process here
- 9:48okay so take a look at this
- 9:51at this time p0 is executed and then
- 9:54you've got idle state here now while it
- 9:57is in idle state
- 9:58process one is currently being executed
- 10:02okay
- 10:02so a context switch of course when the
- 10:05cpu switches from one process to another
- 10:08so that scenario is what you call
- 10:11context switch
- 10:14all right
- 10:15so
- 10:16what is the context switch so when cpu
- 10:19switches to another process
- 10:21the system must save the state of the
- 10:23old process
- 10:24and load the saved state
- 10:27of the new process via context switch
- 10:30okay so context of a process
- 10:34is represented in the pcb
- 10:36okay
- 10:37so whenever an interrupt arrives the cpu
- 10:40must do a state save
- 10:42of the currently running process then
- 10:45switch into a kernel mode to handle the
- 10:47interrupt
- 10:49and then
- 10:50do a state restore of the interrupt
- 10:53process so that's how it works so
- 10:55similarly okay
- 10:57so a contact switch of course when the
- 10:59time slice for one process has expired
- 11:02we're talking about round rolling here
- 11:04okay and a new process is to be loaded
- 11:07from the red eq
- 11:09okay
- 11:10so this will be instigated by the timer
- 11:12interrupt which will then cause the
- 11:15current process state to be saved and
- 11:18the new process state to be restored
- 11:21okay so we have a lot of event that is
- 11:24happening during the context switch
- 11:26so saving and restoring states involved
- 11:28saving and restoring all of the
- 11:30registers and program counters
- 11:32as well as the process control block
- 11:34described
- 11:36earlier
- 11:37okay
- 11:38so context switching happens in a very
- 11:41very frequently and
- 11:43the overhead of doing the switching is
- 11:45just lost cpu time
- 11:47so contacts switches
- 11:50states saves and restores
- 11:52need to be fast as possible because
- 11:54during the context switch
- 11:56during the movement from one process to
- 11:58another the cpu is doing nothing
- 12:02so some hardware has special provisions
- 12:04for speeding this up such a single
- 12:06machine instruction for saving and
- 12:08restoring all registers at once
- 12:12all right so can you now imagine how the
- 12:15operating systems manages this process
- 12:17process switching
- 12:19okay you've got requests coming from the
- 12:21processes
- 12:32[Music]
- 12:40you
About this transcript
This page contains the full transcript of 03 02 Processes Part 2 by Santelmo, generated from the public captions YouTube serves with the video. The transcript has 1,691 words across 319 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.