Sabtu, 21 Maret 2009

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.

Tidak ada komentar:

Posting Komentar