{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lsli13 - 13-1 13-1 Operating Systems Denition An operating...

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

View Full Document Right Arrow Icon
13-1 13-1 Operating Systems Definition: An operating system is the software that manages re- sources in a computer. Resources A resource is (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-1 EE 4770 Lecture Transparency. Formatted 13:26, 23 December 1997 from lsli13. 13-1
Background image of page 1

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

View Full Document Right Arrow Icon
13-2 13-2 Resources Managed on Behalf Of Tasks . Task requests the resource. OS determines if task is allowed the resource. OS determines if task can be given the resource. E.g. , if there is enough available. If both are true, OS grants the task’s request. To service such requests, the OS must keep track of how much of each resource is available and under what conditions requests can be granted. 13-2 EE 4770 Lecture Transparency. Formatted 13:26, 23 December 1997 from lsli13. 13-2
Background image of page 2
13-3 13-3 Resource Allocation and Usage Example Consider 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 and run on some system. The program, from when it starts running until it finishes running, is referred to as a task. In line 1 the task requests address space (a resource). The task asks the OS for 1000 bytes of main-memory address space using the C malloc library 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, malloc returns a null pointer.) 13-3 EE 4770 Lecture Transparency. Formatted 13:26, 23 December 1997 from lsli13. 13-3
Background image of page 3

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

View Full Document Right Arrow Icon
13-4 13-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 by base- Pointer+x . The write makes use of the address-space resource. The system must verify 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 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. If both checks are positive, the OS performs all the actions nec- essary to open the file.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}