Thursday, May 24, 2012

UNIX: Process

Process: A process is a program in execution .
process have 5 state:
1. New : The process is being created.
2. Ready: They have all the resources and ready to allocated to the processor.
3. Running : The process is executing the instructions.
4. Wait : The process is waiting for the i/o or other things.
5  Stop/Terminate : The process has finish the execution.

The process information are stored by the operating system in PCB(Process control Block), which contain the following blocks:


1. process status
2. process number
3. program counter
4. Register
5. Memory Limit
6. List of open files.

****************************************************************************
CONTEXT SWITCHING: Context Switching is the process of storing and restoring the state of CPU. It is essential feature of the multitasking operating system.

CPU Scheduler : Scheduler will select the process from ready processes in memory and will allocate the CPU to process.
Type of Scheduler:
1. short term scheduler
2. long term scheduler
3. medium Term scheduler.

************************************************************************************
PROCESS: When a sub process is created  ( via fork), a new child task is created with a copy of the memory used by the original parent task.
When a new task is created, the memory space used by the parent isn't actually copied to the child instead, both the parent and child reference the same memory space, with the memory pages marked as copy -on -write. When any of the process attempt to write to the memory, a new set of memory pages is created for the process that is private to it alone.

When the fork API function returns, the split occurs, and the return value from fork identifies in which context the process is running.
There is three possibilities from the return of the fork call. When the return value of the fork is greater than zero then we're in the parent context and the value represents the pid of the child . when the return value of the fork is zero the we're in the child context. finally any other value less than zero or negative represent the error.
************************************************************************************

 How to make the object of particular name rather than the a.out

cc -o objectname filename.c


***************************************************************************



 
----- kill -9 Processid (For killing the particular process )
----- Kill -STOP processid (To Stop the process id )
------ Kill - CONT procesid (To continue the process id where it will stop)


AGING: This starvation can be compensated for if the priorities are internally computed. suppose one parameter in the priority assignment function is the amount of time the process has been waiting.

THE LONGER A PROCESS WAITS, THE HIGHER ITS PRIORITY BECOMES .

No comments:

Post a Comment

Qualcomm Short Term

  113 is the SL. 1st Target by mid July.

Total Pageviews