03 04 Processes Part 4 — Transcript
Full transcript
- 0:08[Music]
- 0:19so the process within a system may be
- 0:21independent or cooperating
- 0:24okay
- 0:25so when you say cooperating
- 0:27these are processed okay so it can
- 0:29affect or be affected by
- 0:32other processes including sharing data
- 0:35so the reasons for cooperating processes
- 0:37are information sharing computation
- 0:39speed up
- 0:40modularity and
- 0:42convenience okay so cooperating process
- 0:46needs the inter-process communication or
- 0:49ipc
- 0:50which
- 0:51are represented using the two models
- 0:54also which are the shared memory and
- 0:56the message passing
- 0:59okay
- 1:00now
- 1:01when you say independent process
- 1:03so operating concurrently on the systems
- 1:06are those that can neither
- 1:08affect other processes or be affected by
- 1:10the other processes as mentioned here
- 1:14okay
- 1:14now
- 1:15under three zones
- 1:17what is information sharing in operating
- 1:19process so there may be several
- 1:21processes which need access to the same
- 1:24file for example okay example are
- 1:27pipelines
- 1:28okay
- 1:29so computation speed up
- 1:32so often
- 1:33a solution to a problem can be solved
- 1:36faster if the problem can be broken down
- 1:38into sub tasks
- 1:41okay
- 1:42to be solved simultaneously so
- 1:43particularly when multiple processors
- 1:46are involved here
- 1:48okay
- 1:48modularity
- 1:50the most efficient architecture
- 1:53may be to break the system down into
- 1:55cooperating modules so example databases
- 1:58with a client server architecture
- 2:00okay and the last one would be
- 2:02convenience
- 2:03okay what is convenience in operating
- 2:06process
- 2:07so even a single user may be
- 2:10multitasking
- 2:11such as editing compiling printing and
- 2:13running at the same code
- 2:15in different windows so that's
- 2:17convenience
- 2:19okay
- 2:20now let's see the model mentioned here
- 2:22the shared and the message passing
- 2:26okay
- 2:27now cooperating process requires some
- 2:31uh type of the inter-process
- 2:33communication which is mostly one of
- 2:36these two okay the shared memory
- 2:39or the message passing systems
- 2:42okay now is the difference between these
- 2:44two
- 2:45when you say shared memory this is
- 2:47faster once
- 2:49it is set up
- 2:50so because no system calls are required
- 2:53and access occurs at a normal memory
- 2:55speeds
- 2:56so however
- 2:58it is more complicated to set up and it
- 3:01doesn't work as well across multiple
- 3:04computers
- 3:05so shared memory is generally preferable
- 3:08when large amounts of information
- 3:10must be shared quickly
- 3:12on the same computer
- 3:14okay
- 3:16now for the message passing it requires
- 3:18system calls for every message transfer
- 3:21okay
- 3:23and it's therefore slower but it is
- 3:25simpler to set up and works well with
- 3:29multiple computers or across multiple
- 3:31computers
- 3:32so message passing is generally
- 3:34preferable
- 3:35when the amount and or frequency of data
- 3:38transfer is small
- 3:39or when multiple computers are involved
- 3:43okay so that is when the message passing
- 3:46is
- 3:48useful
- 3:50okay
- 3:52next
- 3:53let's talk about the producer consumer
- 3:55problem
- 3:56okay so the paradigm for operating
- 3:59process
- 4:01so the producer process
- 4:04produces information
- 4:05that is consumed by the consumer process
- 4:09so there are two variations here okay
- 4:11it could be the unbounded proper a
- 4:14buffer or the bounded buffer
- 4:17okay
- 4:18so for these two variations when you say
- 4:20unbounded buffer
- 4:22there is no practical limit on the size
- 4:24of the buffer
- 4:25so the producer never waits and the
- 4:28consumer waits if there is no buffer to
- 4:31consume
- 4:33okay
- 4:35on the bounded buffer
- 4:37it assumes that there is a fixed buffer
- 4:39size so the producer must wait if all
- 4:42buffers are full
- 4:44the consumer wage if there is no buffer
- 4:47to consume
- 4:48so this is a classic example
- 4:51in which one process is producing data
- 4:54and another process is consuming data
- 4:58okay
- 5:00so
- 5:01in this example in the order in which it
- 5:03is produced although
- 5:05that could vary okay so the data is
- 5:08passed via an intermediary buffer
- 5:11which may be either
- 5:13bounded
- 5:15or unbounded
- 5:16okay so with bounded buffer the producer
- 5:19may have to wait until there is a space
- 5:22available
- 5:24okay but when
- 5:26an unbounded buffer the producer the
- 5:29producer will never need to wait
- 5:32okay so the consumer may need to wait in
- 5:35either case until there is a data
- 5:37available
- 5:39okay so that is producer
- 5:41consumer problem
- 5:44okay so we will be using this
- 5:46producer consumer problem on the
- 5:49discussion of deadlocks
- 5:52okay
- 5:54now the inter-process communication for
- 5:55the shared memory okay so an area of
- 5:59memory shared among the process that
- 6:01wish to communicate so the communication
- 6:04is under the control of the users
- 6:06okay
- 6:07major issues to provide mechanisms that
- 6:10will allow the user processes
- 6:12to synchronize their action when they
- 6:14access shared memory
- 6:16so synchronization is discussed in great
- 6:19details in chapter six and seven
- 6:22right
- 6:24next
- 6:26how about the bounded buffer the shared
- 6:28memory solution so this example uses a
- 6:30shared memory and circular queue so note
- 6:34in the code okay
- 6:37that only the producer changes in
- 6:41okay and only the consumer changes out
- 6:46okay
- 6:47so and they can never be accessing the
- 6:49same array location at the same time so
- 6:52first the following data is set up
- 6:55in the shared memory area
- 6:58okay so the solution is correct but it
- 7:02can
- 7:03only use a buffer size -1 elements
- 7:07okay
- 7:10next
- 7:12then the producer process
- 7:15note that the buffer is full when in
- 7:18is one less than out in circular sense
- 7:23okay
- 7:27next
- 7:28the consumer process note that the
- 7:30buffer is empty
- 7:32when in is equal to out
- 7:35okay
- 7:36so
- 7:37[Music]
- 7:39next
- 7:40what about filling all the buffers would
- 7:42that be possible okay so so suppose that
- 7:45we wanted to provide a solution to the
- 7:47consumer producer problem that fills
- 7:51all the buffers
- 7:53what can we do so
- 7:55or we can do so by having an integer
- 7:57counter that keeps track
- 7:59of the number of full buffers so
- 8:01initially the counter is set to zero
- 8:03the integer counter is incremented by
- 8:05the producer after it produces a new
- 8:07buffer
- 8:09and the integer counter is and is
- 8:11decremented by the consumer after it
- 8:13consumes the buffer
- 8:16okay
- 8:18so you'll have this
- 8:20produce an item in the next
- 8:22produced
- 8:24this is for the producer
- 8:26okay
- 8:27and for the consumer
- 8:30you'll have this so if there is a
- 8:33resource available then it needs to be
- 8:35consumed
- 8:36okay
- 8:37so the next one would be the race
- 8:39condition so what is a race condition
- 8:42any time there is or there are two armor
- 8:44processors or threads operating on
- 8:46currently
- 8:48there is a potential for a particularly
- 8:50difficult class of problems
- 8:53we call it race condition
- 8:56okay
- 8:57so the identifying characteristics of
- 8:59phrase conditions is that the
- 9:01performance varies depending on which
- 9:04process or thread executes their
- 9:06instructions
- 9:07before
- 9:08the other one and this becomes a problem
- 9:12when the program runs correctly in some
- 9:14instance and incorrectly in others
- 9:17okay so race conditions are notoriously
- 9:20difficult to debug because they are
- 9:22unpredictable
- 9:24and repeatable and may not exhibit
- 9:26themselves for years
- 9:29okay
- 9:36okay so
- 9:37next
- 9:38note that the above solution also checks
- 9:40the return value from
- 9:42the read system call so to verify the
- 9:45number of characters
- 9:47read is equal to the number expected
- 9:50okay
- 9:51some of those checks were actually in
- 9:52the original code but
- 9:55they were omitted from the nodes for
- 9:57clarity okay
- 9:59and the real code also uses select
- 10:02before reading
- 10:04okay so to verify
- 10:06that there are characters present to
- 10:08read
- 10:10and to delay if not
- 10:12okay
- 10:13so note also that this problem could not
- 10:16be easily solved using synchronization
- 10:19tools
- 10:20that we're going to discuss in chapter
- 10:22six because the problem is not really
- 10:25one of two processes accessing the same
- 10:27data at the same time
- 10:30okay so these problems here about
- 10:33synchronization will be discussed in
- 10:35detail and thoroughly on the next
- 10:38few chapters the next two chapters okay
- 10:41specifically
- 10:44okay so next would be the
- 10:47inter-process communication the message
- 10:49passing
- 10:50message passing systems must support a
- 10:52minimum system calls for send
- 10:54message and receive message
- 10:57so you'll have this
- 10:58all right so these are the ipc facility
- 11:02operations
- 11:04okay
- 11:05so process communicate with each other
- 11:07without resorting to shared variables
- 11:10okay so the message size is either fixed
- 11:13or
- 11:14variable
- 11:18okay
- 11:19so a communication link okay so take
- 11:21note that we have your established
- 11:23communication link okay so a
- 11:25communication link must be established
- 11:27between the operating processes
- 11:30before messages can be sent
- 11:33so there are three key issues to be
- 11:35resolved in message passing systems as
- 11:38further explored in the next three
- 11:40subsections okay so we have the direct
- 11:43or indirect communications
- 11:45naming
- 11:46synchronous or asynchronous
- 11:48communication and automatic or
- 11:51explicit buffering
- 11:53okay so this summarizes this issues here
- 11:58now let's talk about the implementations
- 12:01of the communication link
- 12:02so it's either implemented in physical
- 12:05or logical
- 12:06okay in physical
- 12:08we have the shared memory the hardware
- 12:10bus and the network
- 12:12implementation
- 12:13logically we could have direct or
- 12:15indirect
- 12:16synchronous or asynchronous and
- 12:19automatic or explicit buffering
- 12:22okay now
- 12:24with direct communication
- 12:27okay the sender must know the name of
- 12:29the receiver to which it wishes to send
- 12:33message
- 12:34so for symmetric communication the
- 12:36receiver must also know the specific
- 12:39name of the sender
- 12:40from which it wishes to receive messages
- 12:44well for us asymmetric
- 12:47there is or this is not necessary
- 12:51okay
- 12:53now for indirect communications all
- 12:56right so indirect communication uses
- 12:59shared mailboxes
- 13:00or ports all right
- 13:04so
- 13:05multiple processes
- 13:07can share
- 13:08that
- 13:09mailbox or boxes
- 13:12so only one process can read any given
- 13:15message in a mailbox so initially
- 13:18process that creates the mailbox is the
- 13:20owner
- 13:21and is the only one allowed to read mail
- 13:24in that mailbox although
- 13:27this privilege may be transferred
- 13:29okay
- 13:31so of course
- 13:32the process that reads the message can
- 13:34immediately turn around and place an
- 13:36identical message back in the box for
- 13:38someone else to read
- 13:40but that may put it
- 13:42at the back end of the queue messages
- 13:46okay so the os provides system calls to
- 13:49create and delete mailboxes and to send
- 13:51and receive messages to or from
- 13:53the mailboxes
- 13:56all right so that's indirect
- 13:57communication
- 14:00okay so this is what i mentioned earlier
- 14:05now
- 14:08next is
- 14:10how about mailbox sharing
- 14:11as mentioned earlier for example you've
- 14:13got p1 p2 and p3 shear mailbox a so p1
- 14:18sends p2 and p3 receive who gets the
- 14:21message
- 14:23okay
- 14:24so solution would be
- 14:26allow a link to be associated with most
- 14:28or at most two processes
- 14:31allow only one process at the time to
- 14:33execute a receive operation
- 14:37allow the system to select arbitrarily
- 14:40the receiver
- 14:41sender is not or is notified who the
- 14:44receiver was
- 14:46okay that's indirect
- 14:48communication
- 14:58[Music]
- 15:06you
About this transcript
This page contains the full transcript of 03 04 Processes Part 4 by Santelmo, generated from the public captions YouTube serves with the video. The transcript has 1,726 words across 387 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.