google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.

Sunday, July 20, 2014

Process States and Transitions

List containing complete set of process states:
1. The process is executing in user mode.
2. The process is executing in kernel mode.
3. The process is not executing but is ready to run as soon as the kernel schedules it.
4. The process is sleeping and resides in main memory .
5. The process is ready to run , but swapper (process 0) must swap the process into main memory before the kernel can schedule it to execute.
6. The process is sleeping, and the swapper has swapped the process to secondary storage to make room for other processes in main memory.
7. The process is returning from the kernel to user mode ,but the kernel preemprts it and does a context switch to schedule another process.The distinction between this state and state 3 (ready to run) will be brought out shortly.
8. The process is newly created and is in a transition state ; the process exists, but it is not ready to run , nor is it sleeping . This state  is the start for all processes except process 0.
9. The process executed the exit system call and is in the zombie state. The process no longer exists , but it leaves a record containing an exit code and some timing statistics for its parent process to collect .The zombie state is the final state of a process.

Buffer

Definition :-
The kernel could read and write directly to and from the disk for all file system accesses,but system response time and throughput would be poor because of the slow disk transfer rate . The kernel therefore attempts to minimize frequency of disk access by keeping a pool  of internal data buffers,called the buffer cache which contains the data in recently used disk blocks.

A buffer contains two parts:
a memory array that contains data from the disk and
a buffer header that identifies the buffer.

The status of buffer is a combination of the following conditions:
1. The buffer is  currently locked.
2. The buffer contains valid data 
3. The kernel must write the buffer contents to disk before reassigning the buffer this condition is known as "delayed-write"
4. The kernel is currently reading or writing the contents of the buffer to disk.
5. A process is currently waiting for the buffer to become free

Structure of the buffer pool:
The kernel caches data in the buffer pool according to a least recently used algorithm .
The kernel maintains a free list of buffers that preserves the last recently used order.
The free list is a doubly linked circular list of buffers with a dummy buffer header that marks its beginning and end .
Kernel organizes the buffer into separate queues, hashed as a function of the device and block number.

Five typical scenarios the kernel may follow in getblk to allocate a buffer for a disk block
1. The kernel finds the block on its hash queue, and its buffer is free.
2. The kernel cannot find the block on the hash queue,so it allocates a buffer from the free list .
3. The kernel cannot find the block on the hash queue and in attempting to allocate a buffer from the free list ,finds a buffer on the free list that has been marked "delayed write." The kernel must write the "delayed write" buffer to disk and allocate another buffer.
4. The kernel cannot find the block on the hash queue , and the free list of buffers is empty.
5. The kernel finds the block on the hash queue , but its buffer is currently busy.


 

अच्छे विचार करे विचार

  पहचान की नुमाईश, जरा कम करें... जहाँ भी "मैं" लिखा है, उसे "हम" करें... हमारी "इच्छाओं" से ज़्यादा "सुन...