0% found this document useful (0 votes)
24 views11 pages

Cours SE - Docx en-US

The document provides an overview of operating systems (OS), detailing their definition, architecture, main functions, and types. It covers process management, including process states, structures, and scheduling algorithms, as well as memory and file management. Additionally, it outlines basic commands for Linux and Windows systems.

Uploaded by

Safa Amini
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)
24 views11 pages

Cours SE - Docx en-US

The document provides an overview of operating systems (OS), detailing their definition, architecture, main functions, and types. It covers process management, including process states, structures, and scheduling algorithms, as well as memory and file management. Additionally, it outlines basic commands for Linux and Windows systems.

Uploaded by

Safa Amini
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/ 11

Subscribe to DeepL Pro to translate larger documents.

Visit www.DeepL.com/pro for more information.

An operating system (OS) is a set of programs that manage computer hardware and provide
services to applications and users. It is the intermediary between the user and the hardware.

Course outline: Introduction to operating


1. Introduction to operating

● Definition and role


● History and evolution of operating
● Examples of operating (Windows, Linux, macOS, Unix, Android, iOS)

2. Operating system architecture

● OS layers
● Kernel: monolithic vs. microkernel
● User interface (CLI, GUI)

3. Main operating functions

● Process management: multitasking, scheduling, synchronization


● Memory management: allocation, virtual memory
● File management: file system, permissions
● Peripheral management: drivers, communication with hardware
● User and security management

4. Operating types

● Single- and multiprocessor systems


● Real-time systems (RTOS)
● Embedded systems
● Distributed and cloud systems

5. Basic commands under Linux/Windows

● Linux: ls, cd, mkdir, rm, chmod, ps, top


● Windows: dir, cd, mkdir, del, tasklist, taskkill
Chapter. 1 Introduction
1. Definition and role an operating system
An operating system (OS) is a software package that manages a computer's resources and
provides an interface between the user and the hardware. It enables applications to run, and
performs essential functions such as managing files, processes and memory.

2. History and Evolution of Operating


● 1950s-1960s: First OS (batch processing, monolithic OS)
● 1970s-1980s: Appearance UNIX, MS-DOS
● 1990s: The birth of Windows, Linux and macOS
● 2000s and beyond: modern OSes with advanced graphical interfaces, mobile systems
(Android, iOS)

3. Operating system architecture


An OS is composed of several layers:

● Kernel: central part that manages resources and communicates with the hardware.
● User interface: command line (CLI) or graphical user interface (GUI).
● Libraries and services: facilitate application development and execution.

4. Main operating functions


4.1. Process management

Process management is an essential function of the operating system, enabling the


execution and organization of programs in use.

● Process concept: A process is an instance of a running program. Each process has its
own memory space and can be in different states (new, running, suspended,
finished).
● Multitasking and scheduling: the operating system manages several processes
simultaneously through context switching and process scheduling. Various algorithms
are used, such as :
o FIFO (First In, First Out): The first process to arrive is the first to run.
o Round Robin: Each process receives an equally distributed share of time.
o Priority: The highest-priority processes are run first.
● Inter-process communication (IPC): Processes can communicate via various
mechanisms such as pipes, shared memory and message queues.
● Thread management: A process can be made up of several threads that share the
same memory but run independently.
● Process synchronization: When one process depends on another, mechanisms such
as mutexes and semaphores are used to avoid conflicts and concurrency conditions.

4.2. Memory management

● Memory allocation and release


● Virtual memory and pagination

4.3. File management

● File systems (FAT, NTFS, ext4...)


● File access, organization and protection

4.4. Device management

● Device drivers
● Communication between hardware and OS

4.5. User and security management

● User accounts and access


● Security mechanisms (authentication, antivirus)

5. Operating types
● Single- and multiprocessor systems
● Real Time Systems (RTOS): e.g. for mission-critical applications
● Embedded systems: OS in devices such as smartphones and cars
● Distributed systems and the cloud: OS on multiple connected machines
6. Basic commands for Windows and Linux
Linux: ls, cd, mkdir, rm, chmod, ps, top Windows: dir, cd, mkdir, del, tasklist, taskkill
Chapter. 2 process management
1.1 Process definition
A process is a running program. It is a dynamic entity that represents the execution of a
program with its associated resources (memory, files, I/O).

A process can be made up of several threads, which are sub-parts of the process running
concurrently.

Difference between process and program

Program Process
Static file stored on disk Entity active in memory
Does not consume CPU resources or Uses CPU, memory and other resources
memory resources
Executable as code Has dynamic execution state

Example:

● A web browser (Firefox, Chrome) is a program.


● When executed, it becomes a process, which can contain several threads e.g. one for
the interface, another for page rendering).

1.2 Process states


A process passes through several states during its life cycle.

The main states a process :

1. New→ Process creation


2. Ready→ Awaiting execution
3. Executed→ Currently running on the CPU
4. Blocked→ Waiting for an event (input/output, semaphore, etc.).
5. Completed→ End execution (success or failure)

Process state diagram :


[New]
|
v
[Ready]< ---> [Locked]
| |
v v
[Completed] > [Completed]

Example:

● When a user launches a program, the process changes from New to Ready.
● The operating (OS) allocates CPU to it→ It enters Executed state.
● If it is waiting for an input (e.g. reading a file), it becomes Blocked.
● At the end of its execution, it changes to the Completed state and is deleted from the
system.

1.3 Process structure


A process is organized into several memory sections:

Main parts of a process in memory :

1. Code segment→ Contains program instructions


2. Data segment→ Contains global variables
3. Heap→ Dynamic memory space allocated by malloc() or new
4. Stack→ Stores local variables and function calls

Memory representation :

+-----------------+< ---- High address


| Batte | (Local variables, function calls)
ry
+ +
| Pile | (Dynamically allocated memory)
+ +
| Data segment| (Global variables)
+ +
| Code segment| (Program instructions)
+-----------------+< ---- Low address

Example:

● A program that uses an int x variable= 5;→ x is stored in the segment


data.
● A void f() function { int y= 10; }→ y is stored on the stack.
● A pointer int* p= malloc(sizeof(int));→ Memory is allocated in the heap.
1.4 Process table and PCB (Process Control Block)
The operating system manages each process using a process table, where each entry is called
a PCB (Process Control Block).

The PCB contains :

▪ PID (Process ID): Unique process identifier

▪ Process status: Ready, Running, Blocked, etc.

▪ Ordinal counter: Address of the next instruction to be executed

▪ Processor registers: Current CPU register values

▪ Allocated memory: segment addresses (code, data, stack, heap)

▪ Information on open files

▪ Scheduling information (priority, CPU time used, etc.)

The PCB is updated by the system each time the process status changes.

Practical example under Linux :

To view running processes on Linux :

sh
ps to

or

sh
top

Each line represents a process with its PID, statusCPU and memory usage.
memory.

Process scheduling :
2. Context Switch
When a process is interrupted or replaced, the system performs a context switch.

Stages of contextual change

1. Save current process status


o CPU register values
o Address of next instruction (ordinal counter)
o Memory information and specific registers
2. Loading new process information
o Restoration of registers and instructions in progress
3. Resumption of performance
o The CPU starts executing the new process

Example under Linux

To see the number of context switches :

sh
cat /proc/stat| grep ctxt

This displays the total number of context switches performed by the system.

1. Scheduler types
The OS uses three types scheduler to manage processes:

1.1 Long-Term Scheduler

● Selects which processes to enter into memory execution.


● Present in batch and high-load systems.
● Objective: Maintain a good balance between CPU-bound (CPU-intensive) and
I/O-bound (input/output intensive).
1.2 Short-Term Scheduler

● Selects which of the ready processes is running on the CPU.


● Works very quickly (milliseconds).
● This is the main scheduler for interactive systems.

1.3 Medium-Term Scheduler

● Used for swapping (pausing and resuming processes).


● Temporarily removes a process from memory to free up resources.

2. Scheduling criteria
The scheduler selects the process to run based on :

● CPU utilization→ Maximize CPU occupancy.


● Response time→ Minimize the time between submission of a process and its first
execution.
● Waiting time→ Reduce the total time spent .
● Turnaround time→ Total time to complete a process.
● Fairness→ Ensuring a balanced distribution of resources between processes.

3. Scheduling algorithms
Algorithms vary according to whether they are preemptive (interruption possible) or non-
preemptive (complete execution of one process before moving on to the next).

3.1 First Come, First Served (FCFS)

● Principle: Execution in order of arrival (FIFO queue).


● Type: Non-preemptive.
● Problem: High waiting times for long processes (convoy effect).

Example:

nginx

Process| Arrival time| CPU time| Execution order


P1 | 0 ms | 5 ms | P1→ P2→ P3
P2 | 1 ms | 3 ms |
P3 | 2 ms | 8 ms |

Average waiting = (0+ 4+ 7) / 3= 3.66 ms

3.2 Shortest Job First (SJF)

● Principle: Priority to processes with the shortest CPU time.


● Type: Non-preemptive.
● Problem: Starvation (long processes can be blocked indefinitely).

3.3 Round Robin (RR)

● Principle: Each process receives a quantum of time before interruption.


● Type: Pre-emptive.
● Application: Multitasking and interactive systems.

Example (Quantum= 4 ms):

yaml
P1 (8 ms)| P2 (4 ms)| P3 (9 ms) Lap
1: P1(4)→ P2(4)→ P3(4) Lap 2:
P1(4)→ P3(5)

Benefit: Fast response times for short processes.

3.4 Scheduling by priority

Each process has a numerical value that indicates its priority ().

This ordering can be both preemptive and non-preemptive.

The major drawback of this algorithm is sarvation (low-priority processes can be blocked).

The proposed solution to this problem is the Aging mechanism.


which consists of increasing the priority of old processes with each clock pulse.
3.5 Multilevel Queue Scheduling

● Separation of processes into several queues (e.g. interactive, system, batch).


● Each queue has its own scheduling algorithm.

4. Scheduling in multiprocessor systems


Systems with multiple processors use specific strategies:

● Scheduling symmetric (SMP) → Each CPU executes its its


own scheduler.
● Asymmetrical scheduling→ A central CPU manages process assignment.

Conclusion
Process scheduling is essential to CPU utilization, response times and fairness between
processes. Different algorithms are available, depending on the system's objectives
(responsiveness, throughput, etc.).

Conclusion
In this first part, we have seen:

▪ What a process is and how it differs from a program


▪ Process states and transitions
▪ The memory structure of a process
▪ The PCB and its role in process management

The next section covers the creation and termination of processes, as well as the
inter-process communication (IPC).

You might also like