【正文】
m does no useful work while switching. ? Contextswitch time is mainly dependent on hardware support. ? OS programmer try new structures to reduce contextswitch time whenever possible. PROCESS OPERATION ? Process creation ? Process execution ? Get/set process attributes ? Wait for time/event/ ? Signal events ? Allocate/free memory ? Process termination ? Process munication ? Shardmemory (Threads belonging to single process) ? IPC on the same puter ? C/S on the distributed systems. Process operation: Process creation Parent process create children processes, which, in turn create other processes, forming a tree of processes. Process operation: Process creation ? In general, a process will need certain resources to acplish its task. ? Resource sharing ? Parent and children share all resources. ? Children share subset of parent’s resources. ? Parent and child share no resources. ? Execution ? Parent and children execute concurrently. ? Parent waits until children terminate. Process operation: Process creation ? Address space ? The child process is a duplicate of the parent process. ? The child has a program loaded into it. ? The DEC VMS example ? Creating a new process and loading a specified program into that process and starting it running. ? The UNIX example ? fork system call creates new process ? exec system call used after a fork to replace the process’ memory space with a new program. Process operation: Process termination ? Process executes last statement and asks the operating system to decide it (exit). ? Output data from child to parent (via wait). ? Process’ resources are deallocated. ? Parent may terminate execution of children processes (abort). ? Child has exceeded allocated resources. ? Task assigned to child is no longer required. ? Parent is exiting. ? Operating system does not allow child to continue if its parent terminates. ? Cascading termination. PROCESS COOPERATING ? Independent processes vs cooperating processes ? Independent process cannot affect or be affected by the execution of another process. ? Cooperating process can affect or be affected by the execution of another process ? Why process cooperation? ? Information sharing ? Computation speedup ? Modularity (system) ? Convenience (user) ?