OS LS 3 Fall 24 25
OS LS 3 Fall 24 25
❑ One set of operating-system services provides functions that are helpful to the user:
❑ User interface - Almost all operating systems have a user interface (UI).
❑ Varies between Command-Line Interface (CLI), Graphics User Interface
(GUI), touch-screen, Batch
❑ Program execution - The system must be able to load a program into memory and
to run that program, end execution, either normally or abnormally (indicating error)
❑ I/O operations - A running program may require I/O, which may involve a file or
an I/O device
Operating System Services (cont’d)
❑ Another set of OS functions for ensuring the efficient operation of the system itself
via resource sharing
❑ Resource allocation - When multiple users or multiple jobs running concurrently,
resources must be allocated to each of them
❑ Many types of resources - CPU cycles, main memory, file storage, I/O devices.
❑ Logging - To keep track of which users use how much and what kinds of computer
resources
❑ Protection and security - The owners of information stored in a multiuser or
networked computer system may want to control use of that information, concurrent
processes should not interfere with each other
❑ Protection involves ensuring that all access to system resources is controlled
❑ Security of the system from outsiders requires user authentication, extends to
defending external I/O devices from invalid access attempts
A View of Operating System Services
Service level Architecture
User Operating System Interface - CLI
❑ Voice commands
System Calls
System Calls
Programming interface to the services provided by the OS
Typically written in a high-level language (C or C++)
Mostly accessed by programs via a high-level Application
Programming Interface (API) rather than direct system call use
Three most common APIs are
▪ Win32 API for Windows,
▪ POSIX API for POSIX-based systems (including virtually all
versions of UNIX, Linux, and Mac OS X), and
▪ Java API for the Java virtual machine (JVM)
Note that the system-call names used throughout this text are generic
Example of System Calls
❑ System call sequence to copy the contents of one file to another
file
Example of Standard API
System Call Implementation
❑ Typically, a number associated with each system call
❑ System-call interface maintains a table indexed according to these
numbers
❑ The caller need to know nothing about how the system call is
implemented
❑ Just needs to obey API and understand what OS will do as a result call
❑ Most details of OS interface hidden from programmer by API
❑ Managed by run-time support library (set of functions built into libraries
included with compiler)
API – System Call – OS Relationship
System Call Parameter Passing
❑ Often, more information is required than simply identity of desired
system call
❑ Exact type and amount of information vary according to OS and call
❑ For Communications
❑ create, delete communication connection
❑ send, receive messages if message passing model to host name or
process name
❑ From client to server
❑ Shared-memory model create and gain access to memory regions
❑ transfer status information
❑ attach and detach remote devices
Types of System Calls (cont’d)
❑ For Protection
❑ Control access to resources
❑ Get and set permissions
❑ Allow and deny user access
Examples of Windows and Unix System Calls
Standard C Library Example
❑ C program invoking printf() library call, which calls write()
system call
Example: Arduino
❑ Single-tasking
❑ No operating system
❑ File modification
❑ Text editors to create and modify files
❑ Special commands to search contents of files or perform transformations of the text
❑ Background Services
❑ Launch at boot time
❑ Some for system startup, then terminate
❑ Some from system boot to shutdown
❑ Provide facilities like disk checking, process scheduling, error logging,
printing
❑ Run in user context not kernel context
❑ Known as services, subsystems, daemons
❑ Application programs
❑ Don’t pertain to system
❑ Run by users
❑ Not typically considered part of OS
❑ Launched by command line, mouse click, finger poke
Linkers and Loaders
❑ Source code compiled into object files designed to be loaded into any physical memory location
– relocatable object file
❑ Object, executable files have standard formats, so operating system knows how to load and start
them
The Role of the Linker and Loader
Why Applications are Operating System Specific
❑ Apps compiled on one system usually not executable on other operating systems
❑ Benefits:
❑ Easier to extend a microkernel
❑ Easier to port the operating system to new architectures
❑ More reliable (less code is running in kernel mode)
❑ More secure
❑ Detriments:
❑ Performance overhead of user space to kernel space communication
Microkernel System Structure
Modules Structure of OS
❑ Many modern operating systems
implement loadable kernel
modules (LKMs)
❑ Uses object-oriented approach
❑ Each core component is
separate
❑ Each talks to the others over
known interfaces
❑ Each is loadable as needed
within the kernel