lsli13.4up

lsli13.4up - 13-113-1Operating...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 Resources•Terminal 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. Formatted 13:26, 23 December 1997 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 task’s request.To service such requests, the OS must keep track of how much of eachresource is available and under what conditions requests can begranted.13-2EE 4770 Lecture Transparency. Formatted 13:26, 23 December 1997 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 compiledand run on some system.The program, from when it starts running until it finishes running, isreferred to as atask.In line 1 the task requests address space (a resource).The task asks the OS for 1000 bytes of main-memory addressspace using the Cmalloclibrary function.The OS checks if the task is allowed 1000 more bytes of addressspace.The OS also checks if 1000 bytes of address space is available.If both checks are positive, the space is allocated. (If not,mallocreturns a null pointer.)13-3EE 4770 Lecture Transparency. Formatted 13:26, 23 December 1997 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 systemmust verify that this resource has been allocated.If the task has write permission to this address, then the 3 iswritten.Otherwise, the OS will terminate execution of the program be-fore the 3 is 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 accom-plished within the task’s resource limits....
View Full Document

This note was uploaded on 11/28/2011 for the course EE 4770 taught by Professor Staff during the Fall '99 term at LSU.

Page1 / 8

lsli13.4up - 13-113-1Operating...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online