Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

UNIT-VI : System structure

Contents-

Operating System Services


User Operating-System Interface – Command interpreter, GUI
System Calls
Types of System Calls – Process control, File management,
Device management, Information maintenance, Communication,
Protection
Linux System calls related to file and directory management
Introduction

 OS provides environment for program execution


 The design goals focuses on-
 The services that the system provides
 Interfaces that it makes available to users and
programmers
 Its components and their interconnections
Operating System Services
A view of operating system services is as shown below:
Operating System Services
OS Services:
 User Interface
 Program execution
 I/O Operation
 File-System manipulation
 Communication
 Error detection
Operating System Services
Another set of OS functions for efficient working of
system:
 Resource Allocation
 Accounting
 Protection and Security
User Operating System Interfaces

Two fundamental approaches:


 Command Interpreter
 Graphical User Interfaces
User Operating System Interfaces: Command Line Interface

CLI or command interpreter allows direct command entry

 Some OS include command interpreter in the kernel and some


in systems program

 On systems with multiple command interpreters to choose from,


the interpreters are known as – shells

 Example- Bourne shell, C shell, Bourne-Again shell, Korn shell


and others

 Important function is to get and execute the next user-


specified command.
User Operating System Interfaces: Graphical User Interface

GUI: User friendly desktop metaphor Interface

 Users employ a mouse-based window-and-menu system

 The first GUI appeared on the Xerox Alto computer in 1973

 Various GUI interfaces are available, including the Command


Desktop Environment (CDE) and X-windows systems
System Calls
System calls provides an interface to the services made available by
an OS.
 These calls are generally available as routines written in C and C++
 Generally available as assembly-language instructions
Ex: Reading and writing the files
 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)
An Example: How system calls are used
System Calls(cont…)
 Typically, a number associated with each system call
 System-call interface maintains a table indexed according to these
numbers
 The system call interface invokes the intended system call in OS kernel
and returns status of the system call and any return values
 The caller need 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)
Handling a user application invoking
the open() system call
Passing parameters as a table
Types of system calls

System calls are grouped into six major categories:


 Process control
 File manipulation
 Device manipulation
 Information maintenance
 Communications
 Protection
Process control

 end, abort
 load, execute
 create process, terminate process
 get process attributes, set process attributes
 wait for time
 wait event, signal event
 allocate and free memory
File Management
 create file, delete file
 open, close file
 read, write, reposition
 get and set file attributes
Device management

 request device, release device


 read, write, reposition
 get device attributes, set device attributes
 logically attach or detach devices
Information management

 get time or date, set time or date


 get system data, set system data
 get process, file or device attributes
 set process, file or device attributes
Communication
 create, delete communication connection
 send, receive information
 transfer status information
 attach or detach remote devices

Protection
 control access to resources
 get and set permissions
 allow and deny user access
Examples of Windows and Unix System Calls
Example of Standard C Library
C program invoking the printf() statement
MS-DOS execution: An Example
 Single-tasking

 Shell invoked when system


booted

 Simple method to run program

 No process created

 Single memory space

 Loads program into memory,


overwriting all but the kernel At system startup Running a program

 Program exit -> shell reloaded


Linux System calls related to file and directory

1. https://users.cs.cf.ac.uk/Dave.Marshall/C/node20.html
Management

 open()
 close()
 read()
 write()
 lseek()
 opendir(0
 readdir()
 closedir()
 rewinddir()

You might also like