A process or task is a portion of a program in some stage of execution. A program can consist of several tasks.each process that runs in an operating system is assigned a process control block that holds information about the process , such as a unique ID(a number used to identify the process),the saved state of the process, the process priority and where it is located in memory. A process in a computer system may be in one of a number of different possible states, such as ready - if it can run when the processor becomes free running - it currently has the processor blocked - it cannot run when the processor becomes free When a running process is interrupted by the processor after completing its allotted time, its state is saved in its process control block, its process state changed to ready and its priority adjusted. When a running process accesses an input or output device, or for some reason cannot continue, it is interrupted by the processor, the process state and associated data is saved in the associated process control block. The process state is changed to blocked and the priority adjusted. When the scheduler decides the next task to run, it changes the process state of the selected process to running and loads the saved data associated with that process back into the processor. Typically, an operating system will provide a number of program function calls that can be used to control processes. These are similar to those shown below, block() wakeup() suspend() sleep() change_priority() A process control block or PCB is a data structure (a table) that holds information about a process. Every process or program that runs needs a PCB. When a user requests to run a particular program, the operating system constructs a process control block for that program. Typical information that is stored in a process control block is the location in memory of where the process is the priority of the process a unique process identification number (called PID) the current process state (ready, running, blocked) associated data for the process Processes can intercommunicate by sending message, data or code between them. A process can use OS calls like sendmessage() and getmessage() to exchange messages. Two processes might want to co-operate in performing a particular task. For example a process might want to print to document in response to a user request, so it starts another process to handle the printing and sends a message to it to start printing. Once the process handling the printing request finishes, it sends a message back to the original process, which reads the message and uses this to pop up a dialog box informing the user that the document has been printed. There are other ways in which processes can communicate with each other, such as using a shared memory space. Sometimes a process may need to wait for some other process to finish before it can continue. In this instance, the two processes need to be synchronized together. There are a number of ways in which this can be done. A common method in operating systems is to use a variable called a semaphore that only one process can own at a time There are two calls associated with a semaphore, one to lock it and one to unlock it. When a process attempts to lock a semaphore, it will be successful if the semaphore is free. If the semaphore is already locked, the process requesting the lock will be blocked and remain blocked till the process that has the semaphore unlocks it. When that happens, the process that was blocked will be unblocked and the semaphore can then be locked by it. . A thread is a separate part of a process. A process can consist of several threads, each of which execute separately. For example, one thread could handle screen refresh and drawing, another thread printing, another thread the mouse and keyboard. This gives good response times for complex programs. Windows NT is an example of an operating system which supports multi-threading. Multi-tasking systems support foreground and background processes (tasks). A foreground task is one that the user interacts directly with using the keyboard and screen. A background task is one that runs in the background (it does not have access to the screen or keyboard). Background tasks are usually used for printing.