1. Advanced Operating System
(Programming Assignment #1)
Teacher’s Name Nabeel Sabir Khan
Student Name Farhan Ali
Student Reg.No L1S09MSCS0003
University Of Central Punjab
Faculty of Computer Sciences (PICS)
2. 1. PCB
I. Process Id (The id of the process to which it belongs to)
II. User Id (The Owner of the process who initialize the process)
III. Address Space
a) Program Code (All the code of that is to be executed is placed here. A pointer
called PC points it in the core memory)
b) Static Data
c) Heap
d) Stack
Both heap and stack extends in the opposite directions. There is a pointer SP that
points to the Stack.
IV. Open Files (Keep the information that a particular process is using in its execution and
also shared by the child of that process)
V. Memory management information
VI. Privileged Information (Access that a particular process has)
VII. Scheduling priorities
VIII. Recourses information (All the resources which is occupy by this process)
2. Process Creation & Management
I. fork(), vfork() (used for the creation of a process)
II. wait() (used by a parent process to wait until its child has finish its execution)
III. exec() (used by a process to run another program into it)
IV. read(), write() (used by process to read and write data from memory or from
some shared media)
3. V. pipe() (used to create a inter-process channel that is shared by different
processes.)
VI. exit() (used to terminate a process)
VII. kill() (forcefully terminates the process of another process)
VIII. getpid(), getppid() (used to get the process id and parent process id respectively)
3. C-Program
Void main(){
cout<<”Enter the depth of the tree”;
int tree_depth;
cin>>tree_depth;
main_process = fork();
if(main_process == 0){
cout<<”Process Id is”<<getpid()<<” and parent id is ”<<getppid();
for(int i=1; i<=tree_depth; i++){
}
}
}