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: 13-113-1Operating SystemsDefinition:Anoperating systemis the software that manages re-sources in a computer.ResourcesAresourceis (usually) hardware that needs to be accessed.There are rules for accessing resources. . .. . .rules enforced by the OS.Rules might. . .. . .restrict access to sensitive resources. . .. . .or control access to finite resources.Typical ResourcesTerminal I/O.Filesystem.(Data stored on disk).Main memory.(A.k.a. RAM or core).Sensors and actuators.(In a RTS, for example.)Network services.(To connect to other computers.)Threads.CPU time.OS description here is for a typical multithreaded of Unix. . .. . .other modern operating systems work in a similar fashion.13-1EE 4770 Lecture Transparency. Formatted8:10,3 March 1999 from lsli13.13-113-213-2Resources Managed on Behalf OfTasks.Task requeststhe resource.OS determines if task is allowedthe resource.OS determines if task canbe given the resource.E.g., if there is enough available.If both are true, OS grantsthe tasks request.To service such requests, the OS must keep track of how much of eachresource is available and under what conditions requests can be granted.13-2EE 4770 Lecture Transparency. Formatted8:10,3 March 1999 from lsli13.13-213-313-3Resource Allocation and Usage ExampleConsider the following code fragment./* Allocate 1000 bytes of storage. */1: basePointer = malloc( 1000 ) ;The code fragment above is part of some program which is compiled andrun on some system.The program, from when it starts running until it finishes running, is re-ferred to as atask.In line 1 the task requests address space (a resource).The task asks the OS for 1000 bytes of main-memory address spaceusing the Cmalloclibrary function.The OS checks if the task is allowed 1000 more bytes of address space.The OS also checks if 1000 bytes of address space is available.If both checks are positive, the space is allocated. (If not,mallocre-turns a null pointer.)13-3EE 4770 Lecture Transparency. Formatted8:10,3 March 1999 from lsli13.13-313-413-4/* Write a 3 into element x. */2: basePointer[x] = 3;/* Open a file for output. */3: mf = fopen( "myFile.data" , "w" );In line 2 task writes to main memory.The task will attempt to write to memory address given bybase-Pointer+x.The write makes use of the address-space resource. The system mustverify that this resource has been allocated.If the task has write permission to this address, then the 3 is written.Otherwise, the OS will terminate execution of the program before the 3is written.In line 3 task opens a file for writing, using the filesystem resource.The OS checks if the task has write permission on the file.The OS checks if opening the file for writing could be accomplishedwithin the tasks resource limits....
View Full Document
This note was uploaded on 12/11/2011 for the course EE 4770 taught by Professor Staff during the Fall '99 term at LSU.
- Fall '99