0% found this document useful (0 votes)
66 views30 pages

Sistemet Operative Funksionet e Sistemit Operativ: Lënda

The document discusses the functions of an operating system including dual-mode and multi-mode operation, distinguishing between user mode and kernel mode. It describes process management activities like creating and deleting processes, scheduling processes, and providing synchronization. It also summarizes memory management, file system management, device management, cache management, I/O management, protection and security, virtualization, distributed systems, and common kernel data structures like linked lists, stacks, and queues.

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)
66 views30 pages

Sistemet Operative Funksionet e Sistemit Operativ: Lënda

The document discusses the functions of an operating system including dual-mode and multi-mode operation, distinguishing between user mode and kernel mode. It describes process management activities like creating and deleting processes, scheduling processes, and providing synchronization. It also summarizes memory management, file system management, device management, cache management, I/O management, protection and security, virtualization, distributed systems, and common kernel data structures like linked lists, stacks, and queues.

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

Funksionet e Sistemit Operativ


Artan Mazrekaj

Prishtinë, 2023

1
Dual-mode and Multi-mode Operation

▪ In order to ensure the proper execution of the system, we must be able to


distinguish between the execution of OS code and user-defined code.

▪ User Mode
 The system is in user mode when the OS is running a user application such

as handling a text editor.


 The transition from user mode to kernel mode occurs when the application
requests the help of OS or an interrupt or a system call occurs.
 The mode bit is set to 1 in the user mode. It is changed from 1 to 0 when
switching from user mode to kernel mode.

2
Dual-mode and Multi-mode Operation (cont.)

▪ Kernel Mode (supervisor mode, system mode, or privileged mode)


 The system starts in kernel mode when it boots and after the OS is loaded,

it executes applications in user mode.


 There are some privileged instructions that can only be executed in kernel
mode.
→ These are interrupt instructions, input/output management, etc.

 Whenever the OS gains control of the computer, it is in kernel mode.


 If the privileged instructions are executed in user mode, it is illegal, and a
trap is generated.

▪ Multi-mode
 The system which supports virtualization.

 i.e Virtual Machine Manager (VMM) mode for guest VMs.

3
Funksionet kryesore të Sistemit Operativ

▪ Funksionet kryesore të SO janë:


✓ Memory Management
✓ Processor Management
✓ Device/Mass Storage Management
✓ File Management
✓ Cache Management

4
Process Management

▪ A process is a program in execution. It is a unit of work within the


system.
▪ A process needs resources to accomplish its task:
 CPU, memory, I/O, files

 Initialization data

▪ Single-threaded process has one program counter specifying location of


next instruction to execute:
 Process executes instructions sequentially, one at a time, until the
process completes.

▪ Multi-threaded process has one program counter per thread.

5
Process Management Activities

▪ The OS is responsible for the following activities in connection with


process management:
✓ Creating and deleting user and system processes.
✓ Scheduling processes and threads on the CPUs.
✓ Suspending and resuming processes.
✓ Providing mechanisms for process synchronization.
✓ Providing mechanisms for process communication.
✓ Providing mechanisms for deadlock handling.

6
Memory Management

▪ To execute a program all (or part) of the instructions must be in memory.

▪ Memory management determines what is in memory and when.


 Optimizing CPU utilization and computer response to users.

▪ Memory management activities


 Keeping track of which parts of memory are currently being used and

which process is using them.


 Deciding which processes and data to move into and out of memory.
 Allocating and deallocating memory space as needed.

7
File-system Management

▪ OS provides uniform, logical view of information storage.


 Abstracts physical properties to logical storage unit - file
 Each medium is controlled by device (i.e., disk drive, tape drive)

▪ File-System management
 Files usually organized into directories.

 Access control on most systems to determine who can access

what.
▪ File-System management activities
 Creating and deleting files and directories
 Primitives to manipulate files and directories
 Mapping files onto secondary storage
 Backup files onto stable (non-volatile) storage media
8
Device/Mass-Storage Management

▪ Usually, disks used to store data that does not fit in main memory or data
that must be kept for a “long” period of time.

▪ Device/Mass-Storage Management activities


 Mounting and unmounting

 Free-space management

 Storage allocation

 Disk scheduling

 Partitioning

 Protection

9
Cache Management

▪ Important principle, performed at many levels in a computer (in


hardware, OS, software).
▪ Information in use copied from slower to faster storage temporarily.
▪ Faster storage (cache) checked first to determine if information is there:
 If it is, information used directly from the cache (fast)

 If not, data copied to cache and used there.

▪ Cache management is an important design problem!!!

10
I/O System Management

▪ I/O subsystem responsible for:


 Memory management of I/O including:

- buffering (storing data temporarily while it is being


transferred),
- caching (storing parts of data in faster storage for
performance),
- spooling (the overlapping of output of one job with input
of other jobs).
 General device-driver interface.

 Drivers for specific hardware devices.

11
Protection and Security

▪ Protection – any mechanism for controlling access of processes or


users to resources defined by the OS.
▪ Security – defense of the system against internal and external attacks:
 Huge range, including denial-of-service, worms, viruses, identity

theft, theft of service.


▪ OSes generally first distinguish among users, to determine who can
do what.
 User identities (user IDs, security IDs - SID) include name and associated
number, one per user.
 User ID then associated with all files, processes of that user to determine
access control.
 Group identifier (group ID) allows set of users to be defined and controls
managed, then also associated with each process, file.
 Privilege escalation allows user to change to effective ID with more
rights.
12
Virtualization

▪ Allows OSes to run applications within other OSes.


 Vast and growing industry.

▪ Emulation
 Which involves simulating computer hardware in software, is

typically used when the source CPU type is different from the target
CPU type.
 Generally slowest method.

▪ Virtualization – OS natively compiled for CPU, running guest OSes also


natively compiled.
 VMM (Virtual Machine Manager) provides virtualization services.

13
Virtualizimi (vazhd.)

14
Distributed Systems

 Collection of separate, possibly heterogeneous, systems networked


together

 Network is a communications path, TCP/IP most common.


 Local Area Network (LAN)
 Wide Area Network (WAN)
 Metropolitan Area Network (MAN)
 Personal Area Network (PAN)

A network operating system is an OS that provides features such as file


sharing across the network, along with a communication scheme that
allows different processes on different computers to exchange
messages.

15
Kernel data structures

… several fundamental data structures used extensively in OSes:


Array
 An array is a simple data structure in which each element can be

accessed directly.
→ For example, main memory (RAM) is constructed as an array.

Linked list
 A list represents a collection of data values as a sequence.
 To linked list, the items are linked to one another.

16
Kernel data structures (cont.)

Linked lists – several types


 Singly linked list, each item points to its successor.

 Doubly linked list, a given item can refer either to its predecessor or to its
successor.

 Circularly linked list, the last element in the list refers to the first element,
rather than to null.

17
Kernel data structures (cont.)

Stack
 A stack is a sequentially ordered data structure that uses the Last-In-First-

Out (LIFO) principle for adding and removing items, meaning that the last
item placed onto a stack is the first item removed.
 The operations for inserting and removing items from a stack are known as
push and pop, respectively.

Queue
 A queue, in contrast, is a sequentially ordered data structure that uses the

First-In-First-Out (FIFO) principle: items are removed from a queue in the


order in which they were inserted.

18
Kernel data structures (cont.)

Trees
 A tree is a data structure that can be used to represent data hierarchically.

Data values in a tree structure are linked through parent–child


relationships.
 In a general tree, a parent may have an unlimited number of children.
 In a binary tree, a parent may have at most two children, which we term
the left child and the right child.

19
Kernel data structures (cont.)

Hash Functions and Maps


 A hash function takes data as its input, performs a numeric operation on

the data, and returns a numeric value.


This numeric value can then be used as an index into a table (typically an
array) to quickly retrieve the data.

 One use of a hash function is to implement a hash map, which associates


(or maps) [key:value] pairs using a hash function.

20
Kernel data structures (cont.)

Bitmaps
 A bitmap is a string of n binary digits that can be used to represent the

status of n items.
 For example, suppose we have several resources, and the availability of
each resource is indicated by the value of a binary digit: 0 means that the
resource is available, while 1 indicates that it is unavailable (or vice versa).
 The power of bitmaps becomes apparent when we consider their space
efficiency.
→ Disk drives provide a nice illustration.

21
Computing Environments

Traditional
▪ Stand-alone general-purpose machines.
▪ Portals provide web access to internal servers.
▪ Network computers (thin clients) are like Web terminals.
▪ Mobile computers interconnect via wireless networks.

Mobile
▪ Handheld smartphones, tablets, etc.
▪ Extra feature – more OS features (GPS).
▪ Use IEEE 802.11 wireless, or cellular data networks for connectivity.
▪ Leaders are Apple iOS and Google Android.

22
Computing Environments -> Client-Server

▪ Client-Server systems:
 Many systems now servers, responding to requests generated by

clients:
▪ Compute-server system provides an interface to client to
request services (i.e., database).
▪ File-server system provides interface for clients to store and
retrieve files.

23
Computing Environments -> Peer-to-Peer

▪ P2P does not distinguish clients and servers:


 All nodes are considered peers.

 May each act as client, server or both.


 Node must join P2P network:
▪ Registers its service with central lookup
service on network, or
▪ Broadcast request for service and respond
to requests for service via discovery
protocol.

 Skype is an example of peer-to-peer


computing

24
Computing Environments -> Cloud Computing

▪ Delivers computing, storage, even apps as a service across a network.


▪ Logical extension of virtualization because it uses virtualization as the base
for its functionality.
 Amazon EC2 has thousands of servers, millions of virtual machines,
petabytes of storage available across the Internet, pay based on usage.

25
Computing Environments -> Cloud Computing (cont.)

Cloud Deployment Models


 Public cloud – available via Internet to anyone willing to pay.

 Private cloud – run by a company for the company’s own use.

 Hybrid cloud – includes both public and private cloud components.

 Community cloud - is a cloud infrastructure that allows systems and

services to be accessible by a group of several organizations to share


the information.

Cloud Service Models


 Software as a Service (SaaS) – one or more applications available via

the Internet (i.e., word processor).


 Platform as a Service (PaaS) – software stack ready for application

use via the Internet (i.e., a database server).


 Infrastructure as a Service (IaaS) – servers or storage available over

Internet (i.e., storage available for backup use). 26


Computing Environments - Real-Time Embedded Systems

▪ Embedded Systems:
 These devices are found everywhere,

from car engines and manufacturing


robots to optical drives and microwave
ovens.
 Vary considerable, special purpose,
limited purpose OS, real-time OS.

▪ Real-time OS has well-defined fixed time


constraints:
 Processing must be done within
constraint.
 Correct operation only if constraints met.

27
Free and Open-Source operating systems

▪ Free software (sometimes referred to as free/libre software) not only


makes source code available but also is licensed to allow no-cost use,
redistribution, and modification.
▪ Open-source software does not necessarily offer such licensing.
Thus, although all free software is open source, some open-source
software is not “free”.
 Free software and open-source software are two different ideas championed
by different groups of people.

▪ GNU/Linux is the most famous open-source OS, with some distributions free
and others open-source only.
▪ Microsoft Windows is a well-known example of the opposite closed-source
approach.
▪ Apple’s macOS OS comprises a hybrid approach. It contains an open-source
kernel named Darwin but includes proprietary, closed-source components as
well. 28
Pyetje dhe Diskutime ?

29
The slides are adapted from: Abraham Silberschatz, Peter Baer
Galvin, and Greg Gagne, “Operating System Concepts”, Tenth
Edition

30

You might also like