The Open Source Swiss Army Knife

/code/c/unix_c/
/code/c/unix_c/ + sub-categories
http://www.sirfsup.com/
web directory content
    
      

Not logged in
Chat Register Login
return to:  http:/www.sirfsup.com      /code   /c   /unix_c 
Permalink: processes.txt
Title: add
article options : please login   |  raw source view  

  1. pcb the process control block

  2. forkexec what is the difference

pcb

date structure used for process control. When a process changes state (ready/running/waiting) it is the pcb that ets moved from one list to another. Contains all the info needed to do a context switch (program counter, registers, memory management information (where the page table is for the process))

pcb doesn't contain the stack and heap.

cooperating processes

interact in some way where one process affects another process, for example the consumer and producer processes. It is any processes which can affect one another. So, really, any created process is that, because the sysadmin can terminate the processes.

how processes share memory

doesn't do anything with the pcb. It is related to virtual memory and OS specific.


forking and execing


If you need two independant processes to communicate concurrently then using
a fork() would be best.

quote from
http://ou800doc.caldera.com/SDKsysprog/ProcessCreation_-_fork.html


A child inherits its parent's permissions, working-directory, root-directory,
open files, etc. This mechanism permits processes to share common input
streams in various ways. Files that were open before the fork are shared after
the fork. The processes are informed through the return value of fork as to
which is the parent and which is the child. In any case the child and parent
differ in three important ways:

  • The child has a different process ID.
  • The child has a different parent process ID.
  • All accounting variables are reset to appropriate values in the child.

(source: http://ou800doc.caldera.com/SDKsysprog/ProcessCreation_-_fork.html
)

the new exec'd process takes over the child process ID, the parent knows the
ID.

(source: http://ou800doc.caldera.com/SDKsysprog/ProcessCreation_-_fork.html


Leave a Reply
Your Name:     anonymous
Your Email:
Website:  
Comments:

The author will be notified of your reply.
return to top