0% found this document useful (0 votes)
52 views

Sistemet Operative Shërbimet e Sistemit Operativ: Lënda

The document discusses the various services provided by operating systems including user interfaces, program execution, I/O operations, file system manipulation, communications, error detection, resource allocation, and logging. It describes common user interfaces like command-line interfaces, graphical user interfaces, and touchscreens. The document also explains system calls as a method for programs to request services from the kernel and provides examples of system calls for processes, files, and devices.

Uploaded by

Sara Lohaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Sistemet Operative Shërbimet e Sistemit Operativ: Lënda

The document discusses the various services provided by operating systems including user interfaces, program execution, I/O operations, file system manipulation, communications, error detection, resource allocation, and logging. It describes common user interfaces like command-line interfaces, graphical user interfaces, and touchscreens. The document also explains system calls as a method for programs to request services from the kernel and provides examples of system calls for processes, files, and devices.

Uploaded by

Sara Lohaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

UNIVERSITETI I PRISHTINËS ”HASAN PRISHTINA”

Fakulteti i Inxhinierisë Elektrike dhe Kompjuterike

Lënda: Sistemet Operative

Shërbimet e Sistemit Operativ


Artan Mazrekaj

Prishtinë, 2023

1
Operating System Services

▪ Operating systems provide an environment for execution of programs


and services to programs and users.

The design of a new OS is a major task !!!

▪ We can view an OS from several points:


➢ One view focuses on the services that the system provides;

➢ Another, on the interface that it makes available to users and


programmers;
➢ A third, on its components and their interconnections.

2
Operating System Services (cont.)

▪ One set of OS services provides functions that are helpful to the user:
 User interface - almost all OSes have a User Interface (UI):
- Command-Line Interface/Interpreter (CLI);
- Graphics User Interface (GUI);
- Touch-screens;

 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.
→ For specific devices, special functions may be desired (such as

reading from a network interface or writing to a file system).


3
Operating System Services (cont.)

▪ One set of OS services provides functions that are helpful to the user:
 File-system manipulation - programs need to read and write files and
directories, create and delete them, search them, list file Information,
permission management.
 Communications – processes may exchange information, on the same
computer or between computers over a network.
▪ Communications may be via shared memory or through message
passing.

 Error detection – OS needs to be constantly aware of possible errors.


▪ Errors may occur in the CPU and memory hardware (such as a memory
error or a power failure), in I/O devices (such as a parity error on disk, a
connection failure on a network, or lack of paper in the printer), and in the
user program (such as an arithmetic overflow or an attempt to access an
illegal memory location).
4
Operating System Services (cont.)

▪ Another set of OS services exists 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.
→ 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.
5
A view of Operating System Services

6
User and Operating System Interface -> CLI

▪ Most OSes, including Linux, UNIX, and Windows, treat the


command interpreter as a special program that is running when a
process is initiated or when a user first logs on.
▪ CLI or command interpreter allows direct command entry:
 Sometimes implemented in kernel, sometimes by systems

program.
 Shells.
 Primarily fetches a command from user and executes it.

7
Bourne Shell Command Interpreter

▪ Unix command interpreter.

8
Graphical User Interface (GUI)

▪ User-friendly desktop metaphor interface:


 Usually mouse, keyboard, and monitor

 Icons represent files, programs, actions, etc

 Various mouse buttons over objects in the interface cause

various actions (provide information, options, execute function,


open directory (known as a folder).

▪ Many systems now include both CLI and GUI interfaces:


 Microsoft Windows is GUI with CLI “command” shell.

 Apple Mac OS X is “Aqua” GUI interface with UNIX kernel

underneath and shells available.


 Unix and Linux have CLI with optional GUI interfaces (CDE, KDE,

GNOME).
9
Touchscreen Interfaces

▪ Touchscreen devices require new


interfaces:
• Mouse not possible or not desired.
• Actions and selection based on
gestures.
• Virtual keyboard for text entry.

▪ Voice commands.

10
System Calls

▪ A system call is a method for a computer program to request a service


from the kernel of the OS on which it is running.
▪ A system call is a way for programs to interact with the OS.
▪ System calls are generally available as functions written in C and C++,
although certain low-level tasks (for example, tasks where hardware must
be accessed directly) may have to be written using assembly-language
instructions.
▪ System call provides the services of the OS to the user programs via
Application Program Interface (API).
→ 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).
11
System Calls (cont.)

Why do you need system calls in OS ?

▪ There are various situations where you must require system calls in the
OS. Following of the situations are:
➢ It is must require when a file system wants to create or delete a file.
➢ If you want to read or write a file.
➢ Network connections require the system calls to sending and receiving
data packets.
➢ If you want to access hardware devices, including a printer, scanner, etc.
➢ To create and manage new processes.

12
Example of System Calls

▪ System call sequence to copy the contents of one file to another file:

Unix command: cp in.txt out.txt

13
System Call Implementation

Frequently, systems execute thousands of system calls per second.


Modern OSes are multi-threaded, which means they can handle
various system calls at the same time.
▪ 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:

14
API - System Call - OS Relationship

The handling of a user application


invoking the open() system call.
15
System Call Parameter Passing

▪ Three general methods used to pass parameters to the OS:


i. Simplest: parameters can be passed in registers

ii. When there are more parameters than registers, it should be


stored in a block or table, and the block address should be passed
as a parameter to a register.
- This approach taken by Linux and Solaris.

iii. Parameters placed, or pushed, onto the stack by the program and
popped off the stack by the OS.

16
Parameter passing via Table

17
Types of System Calls

Process control
▪ Process control is the system call that is used to direct the processes.
 Create process, terminate process, end, abort, load, execute.
 Get process attributes, set process attributes.
 Wait for time, wait event, signal event.
 Allocate and free memory.
 Dump memory if error.
 Debugger for determining bugs, single step execution.
 Locks for managing access to shared data between processes.

18
Types of System Calls (cont.)

File management
▪ File management is a system call that is used to handle the files.
 create file, delete file, open, close file.

 read, write, reposition.

 get and set file attributes.

Device management
▪ Device management is a system call that is used to deal with devices.
 request device, release device.

 read, write, reposition.

 get device attributes, set device attributes.

 logically attach or detach devices.

19
Types of System Calls (cont.)

Information maintenance
▪ Information maintenance is a system call that is used to maintain
information.
 get time or date, set time or date

 get system data, set system data

 get and set process, file, or device attributes

Communications
▪ Communication is a system call that is used for communication.
 create, delete communication connection

 Send, receive messages.

 Shared-memory model create and gain access to memory regions.

 transfer status information, attach and detach remote devices.

20
Types of System Calls (cont.)

▪ Protection
 Control access to resources

 Get and set permissions

 Allow and deny user access

21
Examples of Windows and Unix system calls

22
System Services

▪ Another aspect of a modern system is its collection of system services.


▪ System services, also known as system utilities, provide a convenient
environment for program development and execution.
They can be divided into:
 File management/manipulation

 Status information

 Programming language support

 Program loading and execution

 Communications

 Background services

23
System Services (cont.)

▪ File management - Create, delete, copy, rename, print, dump, list, and
generally manipulate files and directories.

▪ Status information
 Some ask the system for info - date, time, amount of available

memory, disk space, number of users;


 Others provide detailed performance, logging, and debugging
information;
 Typically, these programs format and print the output to the terminal
or other output devices;
 Some systems implement a registry - used to store and retrieve
configuration information;

24
System Services (cont.)

▪ File modification
 Text editors to create and modify files.

 Special commands to search contents of files or perform


transformations of the text.
▪ Programming-language support - Compilers, assemblers, debuggers, and
interpreters for common programming languages (such as C, C++, Java, and
Python) are often provided with the OS or available as a separate download.
▪ Program loading and execution- Once a program is assembled or compiled, it
must be loaded into memory to be executed. The system may provide
absolute loaders, relocatable loaders, linkage editors, and overlay loaders.
▪ Communications - Provide the mechanism for creating virtual connections
among processes, users, and computer systems.
 Allow users to send messages to one another’s screens, browse web pages, send
e-mail messages, log in remotely, transfer files from one machine to another.

25
System Services (cont.)

▪ 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.

26
Application Programs

▪ Along with system programs, most OSes are supplied with programs that
are useful in solving common problems or performing common
operations:
→ Application programs.

▪ Such application programs include web browsers, word processors and


text formatters, spreadsheets, database systems, compilers, plotting and
statistical-analysis packages, and games.

27
Linkers and Loaders

▪ Source files are compiled into object files


that are designed to be loaded into any
physical memory location, a format known
as a relocatable object file.

▪ The linker combines these relocatable


object files into a single binary executable
file.

▪ A loader is used to load the binary


executable file into memory, where it is
eligible to run on a CPU core.

28
Why Applications are Operating-System Specific ?

▪ Fundamentally, applications compiled on one OS are not executable on


other OSes.
▪ There are several reasons why applications are operating-system specific:
➢ Different binary formats for program executables,

➢ Different instruction sets for different CPUs, and

➢ System calls that vary from one OS to another.

29
Pyetje dhe Diskutime ?

30

You might also like