Presentasi berjudul: "Proses Konsep Proses Penjadwalan Proses Operasi pada Proses"— Transcript presentasi:
1 ProsesKonsep ProsesPenjadwalan ProsesOperasi pada ProsesKerjasama antar ProsesInterProses CommunicationKomunikasi pada sistem Client-Server
2 KONSEP Proses Definis Proses “Sebuah program yang sedang dijalankan” Sebuah sistem operasi mengeksekusi bermacam-macam program dalam satu waktu:Batch system – jobsTime-shared systems – user programs or tasksPada sistem multiprogramming, CPU menswitch dari satu program ke program lain bahkan ribuan instruksi per milisecond.Sebuah Proses termasuk:program counterstackdata sectionSuatu proses membutuhkan Resource, seperti CPU time, Memory, File, dan I/O device untuk menyelesaikan proses tersebut.
4 TAHAPAN SEBUAH ProsesKetika sebuah Proses dijalankan, hal ini akan mengubah tahapan sebuah proses :new: Proses diciptakanrunning: Proses sedang dijalankanwaiting: Proses sedang menunggu kejadian yang akan terjadi (misal menunggu untuk menyelesaikan I/O atau menerima sinyal)ready: Proses siap dijalankan lagi oleh Prosesorterminated: Proses selesai di eksekusi
6 Tahapan proeses (LANJ...) Process Bloks for InputProses tidak bisa dilanjutkan, secara otomatis akan masuk state blockScheduller picks another ProcessScheduller memindahkan proses yang berjalan terlalu lama dan memanggil proses yang lainScheduller pick this ProcessScheduller mengambil Proses yang tertunda dijalankanInput become AvaliableProses menunggu input dari sebuah output proses yang lain.
7 Proses Control Block (PCB) Informasi yang berhubungan dengan masing-masing proses :Tahapan ProsesProgram counterCPU registersInformasi Penjadwalan CPUInformasi Memory-managementInformasi AccountingInformasi I/O status
9 CPU MENGGANTIKAN DARI SEBUAH Proses KE Proses YANG LAIN
10 Proses Scheduling Queues Job queue – set of all Proseses in the systemReady queue – set of all Proseses residing in main memory, ready and waiting to executeDevice queues – set of Proseses waiting for an I/O deviceProseses migrate among the various queues
13 Context SwitchWhen CPU switches to another Proses, the system must save the state of the old Proses and load the saved state for the new ProsesContext-switch time is overhead; the system does no useful work while switchingTime dependent on hardware support
14 Proses CreationParent Proses create children Proseses, which, in turn create other Proseses, forming a tree of ProsesesResource sharingParent and children share all resourcesChildren share subset of parent’s resourcesParent and child share no resourcesExecutionParent and children execute concurrentlyParent waits until children terminate
15 Proses Creation (Cont.) Address spaceChild duplicate of parentChild has a program loaded into itUNIX examplesfork system call creates new Prosesexec system call used after a fork to replace the Proses’ memory space with a new program
17 Proses TerminationProses executes last statement and asks the operating system to delete it (exit)Output data from child to parent (via wait)Proses’ resources are deallocated by operating systemParent may terminate execution of children Proseses (abort)Child has exceeded allocated resourcesTask assigned to child is no longer requiredIf parent is exitingSome operating system do not allow child to continue if its parent terminatesAll children terminated - cascading termination
18 Cooperating ProsesesIndependent Proses cannot affect or be affected by the execution of another ProsesCooperating Proses can affect or be affected by the execution of another ProsesAdvantages of Proses cooperationinformasi sharingComputation speed-upModularityConvenience
19 Producer-Consumer Problem Paradigm for cooperating Proseses, producer Proses produces informasi that is consumed by a consumer Proses
20 InterProses Communication (IPC) Mechanism for Proseses to communicate and to synchronize their actionsMessage system – Proseses communicate with each other without resorting to shared variablesIPC facility provides two operations:send(message) – message size fixed or variablereceive(message)If P and Q wish to communicate, they need to:establish a communication link between themexchange messages via send/receiveImplementation of communication linkphysical (e.g., shared memory, hardware bus)logical (e.g., logical properties)
21 Implementation Questions How are links established?Can a link be associated with more than two Proseses?How many links can there be between every pair of communicating Proseses?What is the capacity of a link?Is the size of a message that the link can accommodate fixed or variable?Is a link unidirectional or bi-directional?
23 Direct Communication Proseses must name each other explicitly: send (P, message) – send a message to Proses Preceive(Q, message) – receive a message from Proses QProperties of communication linkLinks are established automaticallyA link is associated with exactly one pair of communicating ProsesesBetween each pair there exists exactly one linkThe link may be unidirectional, but is usually bi-directional
24 Indirect Communication Messages are directed and received from mailboxes (also referred to as ports)Each mailbox has a unique idProseses can communicate only if they share a mailboxProperties of communication linkLink established only if Proseses share a common mailboxA link may be associated with many ProsesesEach pair of Proseses may share several communication linksLink may be unidirectional or bi-directional
25 Indirect Communication Operationscreate a new mailboxsend and receive messages through mailboxdestroy a mailboxPrimitives are defined as:send(A, message) – send a message to mailbox Areceive(A, message) – receive a message from mailbox A
26 Indirect Communication Mailbox sharingP1, P2, and P3 share mailbox AP1, sends; P2 and P3 receiveWho gets the message?SolutionsAllow a link to be associated with at most two ProsesesAllow only one Proses at a time to execute a receive operationAllow the system to select arbitrarily the receiver. Sender is notified who the receiver was.
27 Synchronization Message passing may be either blocking or non-blocking Blocking is considered synchronousBlocking send has the sender block until the message is receivedBlocking receive has the receiver block until a message is availableNon-blocking is considered asynchronousNon-blocking send has the sender send the message and continueNon-blocking receive has the receiver receive a valid message or null
28 BufferingQueue of messages attached to the link; implemented in one of three ways1. Zero capacity – 0 messages Sender must wait for receiver (rendezvous)2. Bounded capacity – finite length of n messages Sender must wait if link full3. Unbounded capacity – infinite length Sender never waits
29 Client-Server Communication SocketsRemote Procedure CallsRemote Method Invocation (Java)
30 Sockets A socket is defined as an endpoint for communication Concatenation of IP address and portThe socket :1625 refers to port 1625 on hostCommunication consists between a pair of sockets
32 Remote Procedure Calls Remote procedure call (RPC) abstracts procedure calls between Proseses on networked systems.Stubs – client-side proxy for the actual procedure on the server.The client-side stub locates the server and marshalls the parameters.The server-side stub receives this message, unpacks the marshalled parameters, and peforms the procedure on the server.
Your consent to our cookies if you continue to use this website.