A.) Process State - consist of everything necessary to resume the process execution if it is somehow put aside temporarily.
The process state consists of at least following:
- Code for the program.
- Program's static data.
- Program's dynamic data.
- Program's procedure call stack.
- Contents of general purpose registers.
- Contents of program counter (PC)
- Contents of program status word (PSW).
- Operating Systems resource in use.
A process goes through a series of discrete process states.
- New State: The process being created.
- Running State: A process is said to be running if it has the CPU, that is, process actually using the CPU at that particular instant.
- Blocked (or waiting) State: A process is said to be blocked if it is waiting for some event to happen such that as an I/O completion before it can proceed. Note that a process is unable to run until some external event happens.
- Ready State: A process is said to be ready if it use a CPU if one were available. A ready state process is runable but temporarily stopped running to let another process run.
- Terminated state: The process has finished execution.
B.) Process Control Block - all of the information needed to keep track of a process when switching is kept in a data package. A Process Control Block (PCB, also called Task Control Block or Task Struct) is a data structure in the operating system kernel containing the information needed to manage a particular process. The PCB is "the manifestation of a process in an operating system". The process control block typically contains:
- An ID number that identifies the process (Process Identifier)
- Pointers to the locations in the program and its data where processing last occurred .
- Register contents .
- States of various flags and switches .
- Pointers to the upper and lower bounds of the memory required for the process .
- A list of files opened by the process .
- The priority of the process .
- The status of all I/O devices needed by the process
Each process has a status associated with it. Many processes consume no CPU time until they get some sort of input. For example, a process might be waiting for a keystroke from the user. While it is waiting for the keystroke, it uses no CPU time. While it's waiting, it is "suspended". When the keystroke arrives, the OS changes its status. When the status of the process changes, from pending to active, for example, or from suspended to running, the information in the process control block must be used like the data in any other program to direct execution of the task- switching portion of the operating system. This process swapping happens without direct user interference, and each process gets enough CPU cycles to accomplish its task in a reasonable amount of time. Trouble can begin if the user tries to have too many processes functioning at the same time. The operating system itself requires some CPU cycles to perform the saving and swapping of all the registers, queues and stacks of the application processes. If enough processes are started, and if the operating system hasn't been carefully designed, the system can begin to use the vast majority of its available
C.) Threads - which defines a sequential execution stream within a process. A thread is bound to a single process / address space .
Thread types :
User threads - thread management done by user-level threads library. Kernel does not know about these threads
Kernel threads - Supported by the Kernel and so more overhead than user threads .

0 comments:
Post a Comment