This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CMPSCI 377 Operating Systems Spring 2010 Lecture 3: January 26 Lecturer: Prashant Shenoy TA: Vimal Mathew 3.1 Processes A process is an instance of a computer program that is being sequentially executed by a computer system which may be able to run multiple such processes concurrently. A computer program itself is just source code compiled into machine instructions, while a process is the actual execution of those instructions. There may be many processes running simultaneously for different programs. Alternatively, there may be several processes associated with the same program; for example, opening up several windows of the same program typically means more than one process is being executed. In the computing world, processes are formally defined by the operating system running them and so may differ in detail from one OS to another. In general, a process is composed of a section of memory containing both the application code and its data (the stack and heap), the values of any registers in use, and potentially information about I/O devices being used by the process. The OS provides abstractions to allow the control of processes: starting, stopping, and pausing them. The OS must determine the order that processes are scheduled, and how individual processes are mapped to the hardware CPUs which will actual run them. A single computer processor executes one or more instructions at a time (per clock cycle), one after the other. To allow users to run several programs at once (e.g., so that processor time is not wasted waiting for input from a resource), single-processor computer systems can perform time-sharing. Time-sharing allows processes to switch between being executed and waiting (to continue) to be executed. In most cases this is done very rapidly, providing the illusion that several processes are executing at once. (This is known as concurrency or multiprogramming.) The operating system keeps its processes separated and allocates the resources they need so that they are less likely to interfere with each other and cause system failures (e.g., deadlock or thrashing). The operating system may also provide mechanisms for inter-process communication to enable processes to interact in safe and predictable ways. 3.1.1 Synchronization Example Alice and Bob open a shared bank account. Their initial balance is $0. Each deposit $100. We would expect that the balance now be $200. Consider the following sequence of operations: (1)Alice reads Balance (she reads $0), (2)Alice calculates new balance: Balance + 100 = $100, (3)Bob reads Balance (He also reads $0, as Alice has not yet written the new Balance), (4)Bob calculates new balance: Balance + 100 = $100, (5)Alice writes Balance (she writes $100), (6)Bob writes Balance (he also writes $100)....
View Full Document
- Fall '08
- Operating Systems