Tiap proses digambarkan dalam sistem operasi oleh sebuah process control block (PCB) - juga disebut sebuah control block. Sebuah PCB ditunjukkan dalam gambar(4.2). PCB berisikan banyak bagian-dari informasi yang berhubungan dengan sebuah proses yang spesifik, termasuk ini:
• Keadaan proses: Keadaan mungkin, new ,ready ,running, waiting, halted, dan juga banyak lagi.
• Program counter: Counter mengindikasikan address dari perintah selanjutnya untuk dijalankan untuk ditambah code information pada kondisi apapun. Besertaan dengan program counter, keadaan/ status informasi harus disimpan ketika gangguan terjadi, untuk memungkinkan proses tersebut berjalan/bekerja dengan benar setelahnya
(Gambar 4.3).
• Informasi manajemen memori: Informasi ini dapat termasuk suatu informasi sebagai nilai dari dasardan batas register, tabel page/ halaman, atau tabel segmen tergantung pada sistem memori yangdigunakan oleh sistem operasi (ch 9).
• Informasi pencatatan: Informasi ini termasuk jumlah dari CPU dan waktu riil yang digunakan, bataswaktu, jumlah akun, jumlah job atau proses, dan banyak lagi.
• Informasi status I/O: Informasi termasuk daftar dari perangkat I/O yang di gunakan pada proses ini,suatu daftar open file dan banyak lagi.
• PCB hanya berfungsi sebagai tempat menyimpan/gudang untuk informasi apapun yang dapatbervariasi dari prose ke proses.proses ini.
• CPU register: Register bervariasi dalam jumlah dan jenis, tergantung pada rancangan komputer.Register tersebut termasuk accumulator, index register, stack pointer, general-puposes register,
Element-elemen lain PCB antara lain:
• Identifier: A unique identifier associated with this process, to distinguish it from all other processes.
• State: If the process is currently executing, it is in the running state.
• Priority: Priority level relative to other processes.
• Program counter: The address of the next instruction in the program to be
executed.
• Memory pointers: Includes pointers to the program code and data associated with this process, plus any memory blocks shared with other processes.
• Context data: These are data that are present in registers in the processor while the process is executing.
• I/O status information: Includes outstanding I/O requests, I/O devices (e.g., tape drives) assigned to this process, a list of files in use by the process, and so on.
• Accounting information: May include the amount of processor time and clock time used, time limits, account numbers, and so on.
Sabtu, 21 Maret 2009
Kehadiran dua status Suspend
• Blocked -Blocked/Suspend: If there are no ready processes, then at least one blocked process is swapped out to make room for another process that is not blocked. This transition can be made even if there are ready processes available, if the OS determines that the currently running process or a ready process that it would like to dispatch requires more main memory to maintain adequate performance.
• Blocked/Suspend -Ready/Suspend: A process in the Blocked/Suspend state is moved to the Ready/Suspend state when the event for which it has been waiting occurs. Note that this requires that the state information concerning suspended processes must be accessible to the OS.
• Ready/Suspend - Ready: When there are no ready processes in main memory, the OS will need to bring one in to continue execution. In addition, it might be the case that a process in the Ready/Suspend state has higher priority than any of the processes in the Ready state. In that case, the OS designer may dictate that it is more important to get at the higher-priority process than to minimize swapping.
• Ready -Ready/Suspend: Normally, the OS would prefer to suspend a blocked process rather than a ready one, because the ready process can now be executed, whereas the blocked process is taking up main memory space and cannot be executed. However, it may be necessary to suspend a ready process if that is the only way to free up a sufficiently large block of main memory.Also, the OS may choose to suspend a lower-priority ready process rather than a higherpriority blocked process if it believes that the blocked process will be ready soon. Several other transitions that are worth considering are the following:
• New - Ready/Suspend and New - Ready: When a new process is created, it can either be added to the Ready queue or the Ready/Suspend queue. In either case, the OS must create a process control block and allocate an address space to the process. It might be preferable for the OS to perform these housekeeping duties at an early time, so that it can maintain a large pool of processes that are not blocked.With this strategy, there would often be insufficient room in main memory for a new process;hence the use of the (New SReady/Suspend) transition. On the other hand, we could argue that a just-in-time philosophy of creating processes as late as possible reduces OS overhead and allows that OS to perform the process-creation duties at a time when the system is clogged with blocked processes anyway.
• Blocked/Suspend -Blocked: Inclusion of this transition may seem to be poor design. After all, if a process is not ready to execute and is not already in main ,memory, what is the point of bringing it in? But consider the following scenario: A process terminates, freeing up some main memory.There is a process in the (Blocked/Suspend) queue with a higher priority than any of the processes in the (Ready/Suspend) queue and the OS has reason to believe that the blocking event for that process will occur soon. Under these circumstances, it would seem reasonable to bring a blocked process into main memory in preference to a ready process.
• Running - Ready/Suspend: Normally, a running process is moved to the Ready state when its time allocation expires. If, however, the OS is preempting the process because a higher-priority process on the Blocked/Suspend queue has just become unblocked, the OS could move the running process directly to the (Ready/Suspend) queue and free some main memory.
• Any State - Exit: Typically, a process terminates while it is running, either because it has completed or because of some fatal fault condition. However, in some operating systems, a process may be terminated by the process that created it or when the parent process is itself terminated. If this is allowed, then a process in any state can be moved to the Exit state
• Blocked/Suspend -Ready/Suspend: A process in the Blocked/Suspend state is moved to the Ready/Suspend state when the event for which it has been waiting occurs. Note that this requires that the state information concerning suspended processes must be accessible to the OS.
• Ready/Suspend - Ready: When there are no ready processes in main memory, the OS will need to bring one in to continue execution. In addition, it might be the case that a process in the Ready/Suspend state has higher priority than any of the processes in the Ready state. In that case, the OS designer may dictate that it is more important to get at the higher-priority process than to minimize swapping.
• Ready -Ready/Suspend: Normally, the OS would prefer to suspend a blocked process rather than a ready one, because the ready process can now be executed, whereas the blocked process is taking up main memory space and cannot be executed. However, it may be necessary to suspend a ready process if that is the only way to free up a sufficiently large block of main memory.Also, the OS may choose to suspend a lower-priority ready process rather than a higherpriority blocked process if it believes that the blocked process will be ready soon. Several other transitions that are worth considering are the following:
• New - Ready/Suspend and New - Ready: When a new process is created, it can either be added to the Ready queue or the Ready/Suspend queue. In either case, the OS must create a process control block and allocate an address space to the process. It might be preferable for the OS to perform these housekeeping duties at an early time, so that it can maintain a large pool of processes that are not blocked.With this strategy, there would often be insufficient room in main memory for a new process;hence the use of the (New SReady/Suspend) transition. On the other hand, we could argue that a just-in-time philosophy of creating processes as late as possible reduces OS overhead and allows that OS to perform the process-creation duties at a time when the system is clogged with blocked processes anyway.
• Blocked/Suspend -Blocked: Inclusion of this transition may seem to be poor design. After all, if a process is not ready to execute and is not already in main ,memory, what is the point of bringing it in? But consider the following scenario: A process terminates, freeing up some main memory.There is a process in the (Blocked/Suspend) queue with a higher priority than any of the processes in the (Ready/Suspend) queue and the OS has reason to believe that the blocking event for that process will occur soon. Under these circumstances, it would seem reasonable to bring a blocked process into main memory in preference to a ready process.
• Running - Ready/Suspend: Normally, a running process is moved to the Ready state when its time allocation expires. If, however, the OS is preempting the process because a higher-priority process on the Blocked/Suspend queue has just become unblocked, the OS could move the running process directly to the (Ready/Suspend) queue and free some main memory.
• Any State - Exit: Typically, a process terminates while it is running, either because it has completed or because of some fatal fault condition. However, in some operating systems, a process may be terminated by the process that created it or when the parent process is itself terminated. If this is allowed, then a process in any state can be moved to the Exit state
PROSES
Pembuatan proses:
Pembuatan Proses
Ada beberapa aktifitas berkenaan dengan pembuatan proses, antara lain :
a. Memberi identitas (nama) pada proses yang dibuat;
b. Menyisipkan proses pada list proses atau tabel proses;
c. Menentukan prioritas awal proses;
d. Membuat PCB;
e. Mengalokasikan resource awal bagi proses tersebut.
Ada beberapa kejadian yang menyebabkan pembuatan suatu proses baru, antara lain:
a. Pada lingkungan batch sebagai tambahan atas pemberian job. Setelah menciptakan proses baru, sistem operasi melanjutkan untuk membaca job selanjutnya.
b. Pada ingkungan interaktif, pada saat user baru saja logam;
c. Sebagai tanggapan atas suatu aplikasi (seperti: mencetak file, sistem operasi dapat
menciptakan proses yang akan mengelola pencetakan itu);
d. Proses menciptakan proses lain (child).
Selama eksekusi, suatu proses mungkin akan membuat suatu proses yang baru.
Proses tersebut dinamakan parent, sedangkan proses yang dibuat dinamakan child.
Proses pembuatan proses anak membentuk pohon proses.
Pembagian sumber daya :
• Parent dan child membagi semua sumber daya yang ada
• Child menggunakan sebagian dari sumber daya yang digunakan parent
• Parent dan child tidak membagi sumber daya
Bentuk eksekusi :
• Parent melanjutkan eksekusi beriringan dengan children.
• Parent menunggu hingga beberapa atau seluruh children selesai.
Bentuk ruang alamat :
• Child adalah duplikat dari proses parent.
• Child mempunyai program yang diambil dari dirinya.
Pada UNIX, parent akan membentuk child dengan menggunakan system call
Penghentian Proses
Suatu proses berhenti jika telah menyelesaikan pernyataan terakhir, dan meminta pada sistem operasi untuk menghapusnya dengan menggunakan system call exit. Proses mengembalikan semua data (output) ke parent proses melalui system call wait. Kemudian proses dihapus dari list atau tabel sistem, dilanjutkan dengan menghapus PCB.
Penghapusan proses ini akan menjadi sangat kompleks jika ternyata proses yang akan dihentikan tersebut membuat proses-proses yang lain. Pada beberapa sistem, proses-proses anak akan dihentikan secara otomatis jika proses induknya berhenti. Namun, ada beberapa sistem yang menganggap bahwa proses anak ini terpisah dengan induknya, sehingga proses anak tidak ikut dihentikan secara otomatis pada saat proses induk dihentikan.
Parent dapat menghentikan eksekusi proses child dengan menggunakan system call abort. Proses anak dihentikan parent karena beberapa alasan, antara lain :
• Child mengalokasikan sumber daya melampaui batas
• Tugas child tidak dibutuhkan lebih lanjut
• Parent berhenti, karena system operasi tidak mengijinkan child untuk melanjutkan jika parent berhenti dan terminasi dilanjutkan
Alasan lain adalah:
o Proses selesai mengerjakan tugasnya(selesai normal)
o Proses berjalan melebihi batas waktu
o Memory tidak tersedia
o Proses mengakses kawasan memori yang tidak boleh diakses
o Terjadi kesalahan karena pelanggaran proteksi
o Terjadi kesalahan perhitungan
o Proses menunggu terlalu lama
o Terjadi kegagalan I/O
o Proses mengeksekusi instruksi yang tidak ada
o Proses mengguinakan instruksi yang disimpan untuk SO
o Terjadi kesalahan penggunaan data
o Terjadi intervensi dari operator atau SO (contoh : deadlock)
o Proses induk berahir
o Atas permintaan proses induk
Status Proses
Sebagaimana proses bekerja, maka proses tersebut merubah state (keadaan statis/asal). Status dari sebuah proses didefinisikan dalam bagian oleh aktivitas yang ada dari proses tersebut. Tiap proses mungkin adalah satu dari keadaan berikut ini:
• New:Proses sedang dikerjakan/dibuat.
• Running: Instruksi sednag dikerjakan.
• Waiting:Proses sedang menunggu sejumlah kejadian untuk terjadi (seperti sebuah penyelesaian I/O atau penerimaan sebuah tanda/signal).
• Ready: Proses sedang menunggu untuk ditugaskan pada sebuah prosesor.
• Terminated: Proses telah selsesai melaksanakan tugasnya/mengeksekusi.
Nama-nama tersebut adalah arbitrer/berdasar opini, istilah tersebut bervariasi disepanjang sistem operasi.Keadaan yang mereka gambarkan ditemukan pada seluruh sistem. Namun, sistem operasi tertentu jugalebih baik menggambarkan keadaan /status proses. Adalah penting untuk menyadari bahwa hanya satu proses dapat berjalan pada prosesor manapun pada waktu kapanpun. Namun, banyak proses yang dapat ready atau waiting.
; the possible transitions are as follows:
• Null -New: A new process is created to execute a program.This event occurs
for any of the reasons listed in Table 3.1.
• New -Ready: The OS ! will move a process from the New state to the Ready state when it is prepared to take on an additional process. Most systems set some limit based on the number of existing processes or the amount of virtual memory committed to existing processes. This limit assures that there are not so many active processes as to degrade performance.
• Ready - Running: When it is time to select a process to run, the OS chooses one of the processes in the Ready state.This is the job of the scheduler or dispatcher. Scheduling is explored in Part Four.
• Running -Exit: The currently running process is terminated by the OS if the process indicates that it has completed, or if it aborts. See Table 3.2.
• Running - Ready: The most common reason for this transition is that the running process has reached the maximum allowable time for uninterrupted execution; virtually all multiprogramming operating systems impose this type of time discipline.There are several other alternative causes for this transition, which are not implemented in all operating systems. Of particular importance is the case in which the OS assigns different levels of priority to different processes. Suppose, for example, that process A is running at a given priority level, and process B, at a higher priority level, is blocked. If the OS learns that the event upon which process B has been waiting has occurred, moving B to a
ready state, then it can interrupt process A and dispatch process B.We say that the OS has preempted process A.6 Finally, a process may voluntarily release control of the processor. An example is a background process that performs some accounting or maintenance function periodically.
• Running -Blocked: A process is put in the Blocked state if it requests something
for which it must wait. A request to the OS is usually in the form of a system service call; that is, a call from the running program to a procedure that is part of the operating system code. For example, a process may request a service from the OS that the OS is not prepared to perform immediately. It can request a resource, such as a file or a shared section of virtual memory, that is not immediately available. Or the process may initiate an action, such as an I/O operation, that must be completed before the process can continue.When processes communicate with each other, a process may be blocked when it is waiting for another process to provide data or waiting for a message from another process.
• Blocked -Ready: A process in the Blocked state is moved to the Ready state when the event for which it has been waiting occurs.
• Ready -Exit: For clarity, this transition is not shown on the state diagram. In some systems, a parent may terminate a child process at any time. Also, if a parent terminates, all child processes associated with that parent may be terminated.
• Blocked - Exit: The comments under the preceding item apply.
Pembuatan Proses
Ada beberapa aktifitas berkenaan dengan pembuatan proses, antara lain :
a. Memberi identitas (nama) pada proses yang dibuat;
b. Menyisipkan proses pada list proses atau tabel proses;
c. Menentukan prioritas awal proses;
d. Membuat PCB;
e. Mengalokasikan resource awal bagi proses tersebut.
Ada beberapa kejadian yang menyebabkan pembuatan suatu proses baru, antara lain:
a. Pada lingkungan batch sebagai tambahan atas pemberian job. Setelah menciptakan proses baru, sistem operasi melanjutkan untuk membaca job selanjutnya.
b. Pada ingkungan interaktif, pada saat user baru saja logam;
c. Sebagai tanggapan atas suatu aplikasi (seperti: mencetak file, sistem operasi dapat
menciptakan proses yang akan mengelola pencetakan itu);
d. Proses menciptakan proses lain (child).
Selama eksekusi, suatu proses mungkin akan membuat suatu proses yang baru.
Proses tersebut dinamakan parent, sedangkan proses yang dibuat dinamakan child.
Proses pembuatan proses anak membentuk pohon proses.
Pembagian sumber daya :
• Parent dan child membagi semua sumber daya yang ada
• Child menggunakan sebagian dari sumber daya yang digunakan parent
• Parent dan child tidak membagi sumber daya
Bentuk eksekusi :
• Parent melanjutkan eksekusi beriringan dengan children.
• Parent menunggu hingga beberapa atau seluruh children selesai.
Bentuk ruang alamat :
• Child adalah duplikat dari proses parent.
• Child mempunyai program yang diambil dari dirinya.
Pada UNIX, parent akan membentuk child dengan menggunakan system call
Penghentian Proses
Suatu proses berhenti jika telah menyelesaikan pernyataan terakhir, dan meminta pada sistem operasi untuk menghapusnya dengan menggunakan system call exit. Proses mengembalikan semua data (output) ke parent proses melalui system call wait. Kemudian proses dihapus dari list atau tabel sistem, dilanjutkan dengan menghapus PCB.
Penghapusan proses ini akan menjadi sangat kompleks jika ternyata proses yang akan dihentikan tersebut membuat proses-proses yang lain. Pada beberapa sistem, proses-proses anak akan dihentikan secara otomatis jika proses induknya berhenti. Namun, ada beberapa sistem yang menganggap bahwa proses anak ini terpisah dengan induknya, sehingga proses anak tidak ikut dihentikan secara otomatis pada saat proses induk dihentikan.
Parent dapat menghentikan eksekusi proses child dengan menggunakan system call abort. Proses anak dihentikan parent karena beberapa alasan, antara lain :
• Child mengalokasikan sumber daya melampaui batas
• Tugas child tidak dibutuhkan lebih lanjut
• Parent berhenti, karena system operasi tidak mengijinkan child untuk melanjutkan jika parent berhenti dan terminasi dilanjutkan
Alasan lain adalah:
o Proses selesai mengerjakan tugasnya(selesai normal)
o Proses berjalan melebihi batas waktu
o Memory tidak tersedia
o Proses mengakses kawasan memori yang tidak boleh diakses
o Terjadi kesalahan karena pelanggaran proteksi
o Terjadi kesalahan perhitungan
o Proses menunggu terlalu lama
o Terjadi kegagalan I/O
o Proses mengeksekusi instruksi yang tidak ada
o Proses mengguinakan instruksi yang disimpan untuk SO
o Terjadi kesalahan penggunaan data
o Terjadi intervensi dari operator atau SO (contoh : deadlock)
o Proses induk berahir
o Atas permintaan proses induk
Status Proses
Sebagaimana proses bekerja, maka proses tersebut merubah state (keadaan statis/asal). Status dari sebuah proses didefinisikan dalam bagian oleh aktivitas yang ada dari proses tersebut. Tiap proses mungkin adalah satu dari keadaan berikut ini:
• New:Proses sedang dikerjakan/dibuat.
• Running: Instruksi sednag dikerjakan.
• Waiting:Proses sedang menunggu sejumlah kejadian untuk terjadi (seperti sebuah penyelesaian I/O atau penerimaan sebuah tanda/signal).
• Ready: Proses sedang menunggu untuk ditugaskan pada sebuah prosesor.
• Terminated: Proses telah selsesai melaksanakan tugasnya/mengeksekusi.
Nama-nama tersebut adalah arbitrer/berdasar opini, istilah tersebut bervariasi disepanjang sistem operasi.Keadaan yang mereka gambarkan ditemukan pada seluruh sistem. Namun, sistem operasi tertentu jugalebih baik menggambarkan keadaan /status proses. Adalah penting untuk menyadari bahwa hanya satu proses dapat berjalan pada prosesor manapun pada waktu kapanpun. Namun, banyak proses yang dapat ready atau waiting.
; the possible transitions are as follows:
• Null -New: A new process is created to execute a program.This event occurs
for any of the reasons listed in Table 3.1.
• New -Ready: The OS ! will move a process from the New state to the Ready state when it is prepared to take on an additional process. Most systems set some limit based on the number of existing processes or the amount of virtual memory committed to existing processes. This limit assures that there are not so many active processes as to degrade performance.
• Ready - Running: When it is time to select a process to run, the OS chooses one of the processes in the Ready state.This is the job of the scheduler or dispatcher. Scheduling is explored in Part Four.
• Running -Exit: The currently running process is terminated by the OS if the process indicates that it has completed, or if it aborts. See Table 3.2.
• Running - Ready: The most common reason for this transition is that the running process has reached the maximum allowable time for uninterrupted execution; virtually all multiprogramming operating systems impose this type of time discipline.There are several other alternative causes for this transition, which are not implemented in all operating systems. Of particular importance is the case in which the OS assigns different levels of priority to different processes. Suppose, for example, that process A is running at a given priority level, and process B, at a higher priority level, is blocked. If the OS learns that the event upon which process B has been waiting has occurred, moving B to a
ready state, then it can interrupt process A and dispatch process B.We say that the OS has preempted process A.6 Finally, a process may voluntarily release control of the processor. An example is a background process that performs some accounting or maintenance function periodically.
• Running -Blocked: A process is put in the Blocked state if it requests something
for which it must wait. A request to the OS is usually in the form of a system service call; that is, a call from the running program to a procedure that is part of the operating system code. For example, a process may request a service from the OS that the OS is not prepared to perform immediately. It can request a resource, such as a file or a shared section of virtual memory, that is not immediately available. Or the process may initiate an action, such as an I/O operation, that must be completed before the process can continue.When processes communicate with each other, a process may be blocked when it is waiting for another process to provide data or waiting for a message from another process.
• Blocked -Ready: A process in the Blocked state is moved to the Ready state when the event for which it has been waiting occurs.
• Ready -Exit: For clarity, this transition is not shown on the state diagram. In some systems, a parent may terminate a child process at any time. Also, if a parent terminates, all child processes associated with that parent may be terminated.
• Blocked - Exit: The comments under the preceding item apply.
Langganan:
Postingan (Atom)