sistem operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi...
TRANSCRIPT
![Page 1: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/1.jpg)
Sistem Operasi Sistem Operasi 3333
“Process”“Process”
Antonius Rachmat C, S.Kom, Antonius Rachmat C, S.Kom, M.CsM.Cs
![Page 2: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/2.jpg)
Konsep ProsesKonsep Proses• Proses adalah suatu program yang sedang
dieksekusi (running)– Alokasi process: batch / multiprogramming /
multitasking
• Hal yang dicatat pada saat process running:– Program counter– Program counter
• variabel untuk menyimpan alamat suatu proses yang akan dieksekusi selanjutnya
– Stack / Heap• Tempat penyimpanan temporary data yang dibutuhkan
selama program dieksekusi secara dinamis
– Data section• Berisi variabel global dari suatu proses
– Text• Berisi kode programnya
![Page 3: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/3.jpg)
Process in MemoryProcess in Memory
![Page 4: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/4.jpg)
![Page 5: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/5.jpg)
Status ProsesStatus Proses
• New: pada saat proses pertama kali dibuat
• Running: pada saat proses sedang dieksekusidieksekusi
• Waiting: proses menunggu suatu event lain (contoh: proses I/O)
• Ready: proses siap untuk diekseskusi
• Terminated: pada saat proses sudah selesai dieksekusi
![Page 6: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/6.jpg)
Diagram of Process StateDiagram of Process State
![Page 7: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/7.jpg)
Program Control BlockProgram Control Block
• Setiap proses direpresentasikan kedalamsistem operasi oleh PCB
• PCB adalah informasi yang berhubungandengan proses:– Process state– Process state
– Program counter
– CPU registers
– CPU scheduling information
– Memory-management information
– Accounting information
– I/O status information, etc
![Page 8: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/8.jpg)
Process Control Block (PCB)Process Control Block (PCB)
![Page 9: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/9.jpg)
Penjadwalan Antrian ProsesPenjadwalan Antrian Proses
• job queue: antrian ketika proses berada di CPU, siap dieksekusi
• ready queue: antrian proses yang running pada memori utama, siap dan running pada memori utama, siap dan menunggu untuk masuk ke job queue
• device queue: antrian bila proses tersebut menunggu siapnya peralatan I/O tertentu
• Setiap proses bisa berpindah dari satu antrian ke antrian lain
![Page 10: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/10.jpg)
Ready Queue And Various I/O Device QueuesReady Queue And Various I/O Device Queues
Device queue
![Page 11: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/11.jpg)
Representation of Process SchedulingRepresentation of Process Scheduling
![Page 12: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/12.jpg)
Penjadwal AntrianPenjadwal Antrian
• Long-term scheduler (or job scheduler): menentukan proses mana yang harus dimasukkan ke dalam ready queue.
• Short-term scheduler (or CPU scheduler): menentukan proses mana yang selanjutnya akan dieksekusi dan segera mengalokasikan CPU (masuk ke job queue)
![Page 13: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/13.jpg)
SchedulerScheduler
• Short-term scheduler lebih seringdikerjakan
• Long-term scheduler jarang dikerjakan
• Proses dapat juga dibagi atas 2 macam :• Proses dapat juga dibagi atas 2 macam :
– I/O-bound process – menghabiskan waktu lebih banyak untuk mengerjakan I/O daripada di CPU (short CPU bursts)
– CPU-bound process – jarang melakukan permintaan I/O, menggunakan lebih banyak waktunya di CPU (long CPU bursts)
![Page 14: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/14.jpg)
Context SwitchContext Switch
• Pada saat CPU beralih ke proses lain, sistem harus menyimpan state dari proses lama dan mengambil state dari proses yang baru => context switch
• Context-switch time is overhead; the system does no useful work while switching
• Time dependent on hardware support
![Page 15: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/15.jpg)
CPU Switch From Process to CPU Switch From Process to ProcessProcess
![Page 16: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/16.jpg)
Process CreationProcess Creation
• Parent process can create children processes
• Generally, process identified and managed via a process identifier (pid)
• Model Resource sharing– Parent and children share all resources– Parent and children share all resources– Children share subset of parent’s resources– Parent and child share no resources
• Model Execution– Parent and children execute concurrently– Parent waits until children terminate
![Page 17: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/17.jpg)
Process TerminationProcess Termination ModelModel• Process mengeksekusi perintah terakhir dan
meminta OS untuk menghapusnya (exiting)– Sumber daya proses tersebut didealokasi oleh OS
• Parent akan men-terminate eksekusi child dengan paksa (abort), karena– Child telah menghabiskan resources– Child telah menghabiskan resources
– Task yang ditugaskan pada child sudah selesai
• Jika parent melakukan exiting
– Beberapa OS tidak memperbolehkan child untuk melanjutkan kegiatannya
• All children terminated - cascading termination
![Page 18: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/18.jpg)
Komunikasi antar prosesKomunikasi antar proses
• Sistem operasi kebanyakan menjalankan program secara simultan (concurrent).
• Program yang dijalankan secara • Program yang dijalankan secara simultan itu dapat bekerja sama (coorperating) dengan proses lain ataupun bekerja sendiri (independent)
![Page 19: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/19.jpg)
Alasan Coorperating ProcessAlasan Coorperating Process
• Information Sharing
• Computation Speed-up
• Modularity
• Convenience : mudah, concurrent• Convenience : mudah, concurrent
![Page 20: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/20.jpg)
Communications Models Communications Models
a. Message Passing b. Shared
![Page 21: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/21.jpg)
CommunicationCommunication
• IPC melakukan dua operasi:– send(message) – message size fixed or
variable
– receive(message)
• Jika P dan Q ingin berkomunikasi, mereka harus:harus:– establish a communication link between them
– exchange messages via send/receive
![Page 22: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/22.jpg)
Synchronization on Synchronization on communicationcommunication
• Communication may be either blocking or non-blocking
• Blocking is considered synchronous– Blocking send : sender memblok sampai message
diterima
– Blocking receive : receiver memblok sampai message – Blocking receive : receiver memblok sampai message tersedia
• Non-blocking is considered asynchronous– Non-blocking : setelah mengirim, sender melanjutkan
kegiatannya, tidak perlu menunggu message diterima
– Non-blocking receiver menerima message baik valid ataupun tidak (null)
![Page 23: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/23.jpg)
Message Buffering Message Buffering
• Antrian message yang ditempatkan pada link; diimplementasikan dengan:1. Zero capacity – 0 messages1. Zero capacity – 0 messages
Sender must wait for receiver -> no buffer
2. Bounded capacity – finite length of nmessagesSender must wait if link full
3. Unbounded capacity – infinite length Sender never waits
![Page 24: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/24.jpg)
Communications in ClientCommunications in Client--Server Server SystemsSystems
• Sockets
• Remote Procedure Calls (RPC)
• Remote Method Invocation (RMI Java)Java)
• .NET Remoting
![Page 25: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/25.jpg)
SocketsSockets• Sebuah programming interface yang memungkinkan
proses untuk saling berkomunikasi ke proses lainya• The socket 161.25.19.8:1625 refers to port 1625 on host
161.25.19.8
• Communication consists between a pair of sockets
![Page 26: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/26.jpg)
Client Client -- ServerServer
![Page 27: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/27.jpg)
Remote Procedure CallsRemote Procedure Calls• Remote procedure call (RPC)
mengabstraksikan procedure calls antara processes pada jaringan komputer
• Stubs – client-side proxy for the actual procedure on the serverprocedure on the server
• Skeleton – server side proxy• The client-side stub locates the server and marshalls the parameters
• The server-side stub receives message, unpacks the marshalled parameters, and performs the procedure on the server
![Page 28: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/28.jpg)
Remote Method InvocationRemote Method Invocation• Remote Method Invocation (RMI) is a Java mechanism
similar to RPCs
• RMI allows a Java program on one machine to invoke a method on a remote object
![Page 29: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/29.jpg)
Marshalling ParametersMarshalling Parameters
![Page 30: Sistem Operasi 3 - lecturer.ukdw.ac.idlecturer.ukdw.ac.id/anton/download/so3.pdf · sistem operasi oleh PCB • PCB adalah informasi yang berhubungan dengan proses: – Process state](https://reader031.vdocuments.mx/reader031/viewer/2022021615/5cae69f688c9938f4d8ce29f/html5/thumbnails/30.jpg)
NEXTNEXT
• Threads