Operating System Services

When you save an engineering drawing, run a simulation, or collect measurements, your application needs resources that other applications also use. Operating system services coordinate those requests. They provide controlled access to processor time, memory, files, and devices, while helping prevent one application from interfering with another. Understanding these services lets you explain both successful operations and outcomes such as waiting or permission errors.

Service requests and protection

An application usually requests operating system help through a programming interface. A system call is a controlled request from a running program for a service provided by the operating system's kernel, its privileged core. Opening a file, requesting memory, and reading a device are common examples. A library function may make one or more system calls on the application's behalf.


The operating system checks the request before performing a protected operation. For example, it can check whether a file exists and whether the requesting process has permission to write to it. A rejected request can return an error even when the hardware is working correctly.


An application sends a request to operating system services, which manage a device operation and return a result or error.


Protection also limits access to privileged operations and private memory. Applications normally run with fewer privileges than the kernel. This separation helps contain mistakes: an ordinary application should not be able to overwrite another application's protected memory simply by choosing its address.



Managing shared resources

A process is a running instance of a program, together with its execution state and managed resources. Several processes may need the same processor. The scheduler chooses which ready process receives processor time.


The following simplified states describe different reasons a process might not be executing.


State

Meaning

What allows execution?

Running

Currently executing on a processor

It already has processor time

Ready

Able to execute but waiting for processor time

The scheduler selects it

Blocked

Waiting for an event, such as input completion

The event occurs, then the process can become ready


When one process blocks for input, another ready process can use the processor. The blocked process does not necessarily resume immediately when input arrives: it first becomes eligible to run. A context switch saves one execution context and restores another, allowing processor sharing but taking some time itself.


Memory services allocate space and enforce access boundaries. File services organize stored data and check access permissions. Device services coordinate input and output through drivers, which provide device-specific control. These services work together: saving a file can involve a permission check, memory buffers, device operations, and waiting.



Accounting for capacity and time

Use an explicit accounting model before calculating resource availability. In a simplified system with no swapping and no other reservations, available physical memory is


Mavailable=Musable−MOS−∑Mapplications.M_{\text{available}}=M_{\text{usable}}-M_{\text{OS}}-\sum M_{\text{applications}}.


All memory quantities must use the same unit. Real systems also use caching and virtual memory, so apply this simple equation only when the stated assumptions permit it.


Response time measures elapsed time from a specified request to completion:


tresponse=tcompletion−trequest.t_{\text{response}}=t_{\text{completion}}-t_{\text{request}}.


It can include useful processing, operating system work, and waiting. Overlapping activities must not be added as though they happened sequentially.


For one processor observed over a fixed interval, a useful simplified accounting identity is


Telapsed=Tuseful+TOS+Tidle.T_{\text{elapsed}}=T_{\text{useful}}+T_{\text{OS}}+T_{\text{idle}}.


Here, useful time means application work, operating system time means service overhead, and idle time means the processor executes neither category. The categories are defined to be nonoverlapping. More overhead does not by itself prove worse performance: better coordination might reduce idle time enough to increase useful work.


What to remember

  • Services provide controlled access to shared resources.
  • Ready processes await processor time; blocked processes await an event.
  • File permissions and private-memory protection serve different purposes.
  • State accounting assumptions and distinguish elapsed time from processor work.

Example: Resource requests on a laboratory computer

A laboratory computer has 4096 MiB of usable physical memory. The operating system reserves 768 MiB, a measurement application holds 1152 MiB, and a plotting application holds 896 MiB. Here, 1 MiB=220 bytes1\ \text{MiB}=2^{20}\ \text{bytes}.


For this simplified model, all listed allocations occupy physical memory, no memory can be reclaimed, swapping is disabled, and there are no other reservations. A new analysis application requests 1500 MiB. Separately, the plotting application attempts to overwrite a calibration file for which its account has read permission but no write permission.


a) How much physical memory is available before the new analysis request?


Account for each existing allocation once, then subtract their total from usable physical memory. Every value is already expressed in MiB, so no unit conversion is needed.


Mallocated=768+1152+896=2816 MiB,Mavailable=4096−2816=1280 MiB.\begin{aligned} M_{\text{allocated}}&=768+1152+896\\ &=2816\ \text{MiB},\\ M_{\text{available}}&=4096-2816\\ &=1280\ \text{MiB}. \end{aligned}


The computer has 1280 MiB available under the stated model. As a check, 2816+1280=4096 MiB2816+1280=4096\ \text{MiB}, matching the usable total.


b) Can the analysis application's entire request be granted immediately? Calculate the additional memory that would need to become available.


Compare the complete request with the available physical memory. The model excludes swapping and reclaiming memory, so those mechanisms cannot supply the shortfall in this calculation.


Mshortfall=Mrequested−Mavailable=1500−1280=220 MiB.\begin{aligned} M_{\text{shortfall}}&=M_{\text{requested}}-M_{\text{available}}\\ &=1500-1280\\ &=220\ \text{MiB}. \end{aligned}


The entire request cannot be granted immediately under these assumptions. At least 220 MiB must become available before the full request can fit. The operating system might reject or defer the request, depending on its allocation policy; the capacity calculation alone does not specify which response it uses.


c) Would freeing 300 MiB from an existing application authorize the plotting application to overwrite the calibration file? Also determine whether that release would resolve the analysis application's memory shortfall.


Treat resource capacity and access authorization separately. Releasing memory changes the allocation budget, but it does not change the plotting account's file permissions. The overwrite remains unauthorized because the account lacks write permission.


For the analysis application, add the released memory to the available amount:


Mavailable after release=1280+300=1580 MiB,Mremaining after allocation=1580−1500=80 MiB.\begin{aligned} M_{\text{available after release}}&=1280+300\\ &=1580\ \text{MiB},\\ M_{\text{remaining after allocation}}&=1580-1500\\ &=80\ \text{MiB}. \end{aligned}


The release would provide enough capacity for the full analysis request, leaving 80 MiB after allocation. It would not authorize the file overwrite: that requires appropriate write permission, independent of the memory budget.

A student can open a shared laboratory report but receives a permission error when trying to save changes to the same file. The file is marked read-only for the student's account. Which operating system service directly explains this result?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A laboratory computer runs measurement software alongside other applications. Match each operating system term to the description that best identifies its role.

Match each term
A.

A mechanism that maps addresses used by a program to physical storage locations

B.

Core software that manages resources and can directly access protected hardware operations

C.

A controlled request through which an application asks the operating system to perform a service

D.

Software that handles communication with a particular type of hardware such as a printer or sensor

Device driver

System call

Kernel

Virtual memory

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A data-logging process blocks while waiting for a sensor reading. Another process uses the computer's single processor. When the sensor reading arrives, the logging process has everything it needs to continue, but the scheduler has not yet selected it. In the simplified running, ready, and blocked state model, what happens to the logging process?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice