YouTube2Text

03 02 Processes Part 2 — Transcript

by Santelmo · 1,691 words · 319 segments · language en · Watch on YouTube

Full transcript

  1. 0:08[Music]
  2. 0:21all right so the next thing would be the
  3. 0:23process scheduling
  4. 0:25or the cpu scheduling okay
  5. 0:27so process scheduler selects among
  6. 0:30available processes
  7. 0:32for the next execution of the cpu or on
  8. 0:34the cpu core so the goal here is to
  9. 0:37maximize the cpu use
  10. 0:39in other terms we have to keep the cpu
  11. 0:41as busy as possible so we always want to
  12. 0:44get a hundred percent of cpu utilization
  13. 0:47here and
  14. 0:48quickly switch processes onto the cpu
  15. 0:51core
  16. 0:52so the two main objectives of process
  17. 0:54scheduling systems first are
  18. 0:57to keep the cpu busy at all times and
  19. 1:00second
  20. 1:01deliver acceptable response times for
  21. 1:04all the program particularly for
  22. 1:06interactive ones
  23. 1:08right so i'll repeat
  24. 1:10there are two objectives or main
  25. 1:12objectives of process scheduling
  26. 1:15so the first one is we have to keep the
  27. 1:18cpu as busy as possible okay keep the
  28. 1:21cpu busy at all times
  29. 1:23and deliver acceptable response
  30. 1:26for all the programs particularly for
  31. 1:28interactive ones
  32. 1:30all right so the process scheduler must
  33. 1:32meet these objectives by implementing
  34. 1:34suitable policies for swapping processes
  35. 1:36in and out of the cpu
  36. 1:39okay
  37. 1:40so
  38. 1:41note that these objectives can be
  39. 1:44conflicting in particular
  40. 1:46every time the system steps into a swap
  41. 1:48process
  42. 1:49it takes up time on the cpu to do so
  43. 1:52which thereby lost from doing any useful
  44. 1:56productive work
  45. 1:58okay
  46. 1:59so aside from that the process scheduler
  47. 2:02maintains scheduling cues of a process
  48. 2:05so you've got the ready queues and the
  49. 2:07weighting cues okay so what's the
  50. 2:09difference between these two
  51. 2:10when you see a ridicule these are set of
  52. 2:13all processes residing in the main
  53. 2:15memory
  54. 2:16ready and waiting to be executed
  55. 2:19okay
  56. 2:20and when you say weight queue
  57. 2:22these are set of processes waiting for
  58. 2:24an event
  59. 2:25to occur for example an i o
  60. 2:29right so processes migrate from among
  61. 2:32the various queues depending upon the
  62. 2:35state of the process
  63. 2:39okay
  64. 2:41so i have here the ready and waiting
  65. 2:43queues okay so sometimes when the
  66. 2:46process is preempted okay so it will be
  67. 2:49going back to the ram
  68. 2:51okay so ready and waiting for
  69. 2:54the next execution time
  70. 2:56so all processes are basically stored in
  71. 2:59the job queue
  72. 3:00okay or process queue
  73. 3:02okay so
  74. 3:04next would be
  75. 3:06process is in the ready state
  76. 3:08they are placed in the ready queue
  77. 3:11right so processors waiting for a device
  78. 3:15to become available to deliver data are
  79. 3:17placed in the device queues
  80. 3:20so we have a lot of views here
  81. 3:22these are generally a separate device
  82. 3:25for queue for each of the device there
  83. 3:28so other queues are also be created
  84. 3:31and used as needed
  85. 3:35all right
  86. 3:37okay
  87. 3:38so next would be the representation of a
  88. 3:41process scheduling
  89. 3:44okay
  90. 3:44so for the schedulers we have what you
  91. 3:47call
  92. 3:48a long-term scheduler
  93. 3:50this is a typical batch of system
  94. 3:53or a very heavily loaded system it runs
  95. 3:56infrequently
  96. 3:57such as when one process and selecting
  97. 4:00one more to be loaded
  98. 4:02in from a disk in its place
  99. 4:04and can afford to take the time to
  100. 4:07implement intelligent
  101. 4:09and advanced cpu scheduling algorithm
  102. 4:13okay so that's long-term scheduler
  103. 4:15we also have a short-term scheduler
  104. 4:17another term for that is cpu scheduler
  105. 4:21okay so the cpu scheduler runs very
  106. 4:24frequently
  107. 4:25on the order of 100 milliseconds
  108. 4:28and must be very quickly swap one
  109. 4:30process out of the cpu
  110. 4:32and swap in another one
  111. 4:35so some systems are also employ a medium
  112. 4:38term scheduler
  113. 4:39so when the system loads gets high
  114. 4:42this scheduler will swap one or more
  115. 4:44processes out of the ready queue
  116. 4:47for a few seconds so in order to allow
  117. 4:49smaller faster jobs to finish
  118. 4:52so and clear the system
  119. 4:54so next would be an efficient scheduling
  120. 4:57system
  121. 4:58will be select or will select a good
  122. 5:01process mix of the cpu bound process and
  123. 5:05an i o bound process
  124. 5:07okay
  125. 5:08now take a look at the cpu scheduling
  126. 5:10here so
  127. 5:11whenever you run an application okay so
  128. 5:14basically
  129. 5:15that application will be placed on the
  130. 5:18reticule so rediq that means the process
  131. 5:21is now on the ram
  132. 5:23ready for the execution okay it already
  133. 5:26has the resources needed maybe for
  134. 5:28execution
  135. 5:30so on the red state it will be forwarded
  136. 5:32to the cpu for execution
  137. 5:34this processes are executed by the cpu
  138. 5:37one at the time
  139. 5:39all right so one at a time so it's a
  140. 5:41matter of milliseconds
  141. 5:43all right now if the process burst time
  142. 5:46okay so let's say burst time here
  143. 5:48okay burst time is the amount of time
  144. 5:50needed by the process to complete the
  145. 5:52execution so for instance
  146. 5:55that process has already served
  147. 5:58the first time so that means
  148. 6:00the process state would be terminated
  149. 6:03okay
  150. 6:05now on the cpu if the process is
  151. 6:07currently executed it can be preempted
  152. 6:11so we say preempted
  153. 6:12during the execution it can be pulled
  154. 6:15out from the cpu
  155. 6:17and if it is not yet done it has to fall
  156. 6:19in line back again to the reticule
  157. 6:23now what would be that instances
  158. 6:26where in
  159. 6:27the process can be preempted from the
  160. 6:29cpu execution so these are the following
  161. 6:32so there might be an i o request coming
  162. 6:34from the keyboard
  163. 6:36all right
  164. 6:37so
  165. 6:38that would lead to an i o weight queue
  166. 6:41you've got an i o there so the process
  167. 6:43will be
  168. 6:44on going back to the reticule
  169. 6:47or maybe you are using a round robin cpu
  170. 6:50scheduling and the time slice
  171. 6:52has expired so when you say when you say
  172. 6:55time slice
  173. 6:57this is similar to the term quantum
  174. 7:00okay and quantum is the amount of time
  175. 7:02given to a process
  176. 7:04to stay in the cpu for execution
  177. 7:07all right so we call it time slice next
  178. 7:11another instance that the process can be
  179. 7:13preempted from the executes on on the
  180. 7:15cpu would be
  181. 7:16there is a child process that needs to
  182. 7:18be executed
  183. 7:20and when the child termination
  184. 7:22wait you
  185. 7:23for that process so the child will be
  186. 7:26terminated and again
  187. 7:28that process will be going back to the
  188. 7:30ridicule for the next execution time
  189. 7:34okay
  190. 7:35and the last one would be
  191. 7:37the wait for an interrupt here
  192. 7:39so there might be an interrupt during
  193. 7:41the execution of the process that's why
  194. 7:44it was preempted and therefore
  195. 7:46placed
  196. 7:47into the reticule
  197. 7:49all right
  198. 7:50so that's how process works inside the
  199. 7:53cpu
  200. 7:54between the memory or the ram and the
  201. 7:57cpu
  202. 8:01all right
  203. 8:02next let's talk about the cpu switch
  204. 8:04from one process to another
  205. 8:07okay so take note that the cpu can
  206. 8:10execute one job at a time for example we
  207. 8:13have two processes here
  208. 8:15namely p0 and p1 it could be any
  209. 8:18applications on your computer let's say
  210. 8:20this is microsoft word here for p0 and
  211. 8:23p1 is for powerpoint
  212. 8:25okay
  213. 8:26so what happened here and what happened
  214. 8:28here is that
  215. 8:29for example at the current time or at
  216. 8:31time zero okay process zero is being
  217. 8:34executed
  218. 8:35okay so because of the interrupt or
  219. 8:38system call okay so p0 will be stored or
  220. 8:42save the state into the pcb
  221. 8:44for process zero take note that each
  222. 8:47process has their own process control
  223. 8:49block
  224. 8:51all right
  225. 8:52so what will happen is okay
  226. 8:55so if there is an interrupt here
  227. 8:57there might be the instance or an
  228. 8:59instance where in the process is idle
  229. 9:01waiting for another chance of execution
  230. 9:04so on this area here the process is in
  231. 9:09the waiting queue
  232. 9:11or in the ready queue so that means they
  233. 9:13are ideal
  234. 9:15okay
  235. 9:15now if one process is idle there might
  236. 9:18be another process that is currently
  237. 9:20being executed
  238. 9:22okay
  239. 9:22and when you say cpu switch from one
  240. 9:25process to the other okay so take note
  241. 9:28that the cpu is processing
  242. 9:30one process or one job at a time
  243. 9:33so if the process is not able to finish
  244. 9:36the execution or if the burst time
  245. 9:39has not been served
  246. 9:40and it has been
  247. 9:42preempted
  248. 9:44okay so that's the time the cpu is
  249. 9:46executing another process here
  250. 9:48okay so take a look at this
  251. 9:51at this time p0 is executed and then
  252. 9:54you've got idle state here now while it
  253. 9:57is in idle state
  254. 9:58process one is currently being executed
  255. 10:02okay
  256. 10:02so a context switch of course when the
  257. 10:05cpu switches from one process to another
  258. 10:08so that scenario is what you call
  259. 10:11context switch
  260. 10:14all right
  261. 10:15so
  262. 10:16what is the context switch so when cpu
  263. 10:19switches to another process
  264. 10:21the system must save the state of the
  265. 10:23old process
  266. 10:24and load the saved state
  267. 10:27of the new process via context switch
  268. 10:30okay so context of a process
  269. 10:34is represented in the pcb
  270. 10:36okay
  271. 10:37so whenever an interrupt arrives the cpu
  272. 10:40must do a state save
  273. 10:42of the currently running process then
  274. 10:45switch into a kernel mode to handle the
  275. 10:47interrupt
  276. 10:49and then
  277. 10:50do a state restore of the interrupt
  278. 10:53process so that's how it works so
  279. 10:55similarly okay
  280. 10:57so a contact switch of course when the
  281. 10:59time slice for one process has expired
  282. 11:02we're talking about round rolling here
  283. 11:04okay and a new process is to be loaded
  284. 11:07from the red eq
  285. 11:09okay
  286. 11:10so this will be instigated by the timer
  287. 11:12interrupt which will then cause the
  288. 11:15current process state to be saved and
  289. 11:18the new process state to be restored
  290. 11:21okay so we have a lot of event that is
  291. 11:24happening during the context switch
  292. 11:26so saving and restoring states involved
  293. 11:28saving and restoring all of the
  294. 11:30registers and program counters
  295. 11:32as well as the process control block
  296. 11:34described
  297. 11:36earlier
  298. 11:37okay
  299. 11:38so context switching happens in a very
  300. 11:41very frequently and
  301. 11:43the overhead of doing the switching is
  302. 11:45just lost cpu time
  303. 11:47so contacts switches
  304. 11:50states saves and restores
  305. 11:52need to be fast as possible because
  306. 11:54during the context switch
  307. 11:56during the movement from one process to
  308. 11:58another the cpu is doing nothing
  309. 12:02so some hardware has special provisions
  310. 12:04for speeding this up such a single
  311. 12:06machine instruction for saving and
  312. 12:08restoring all registers at once
  313. 12:12all right so can you now imagine how the
  314. 12:15operating systems manages this process
  315. 12:17process switching
  316. 12:19okay you've got requests coming from the
  317. 12:21processes
  318. 12:32[Music]
  319. 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.