You are on page 1of 23

UNIX/LINUX

Presented By : Group 3
Table of content
Linux goals (Vĩnh Khánh)
Processes in Linux
Fundamental Concepts (Hoài Linh)
Process-Management System Calls in Linux (Hoài Linh)
Implementation of Processes and Threads in Linux
(Thanh Hiếu)
Scheduling in Linux (Thanh Hiếu)
Booting Linux (Bảo Hân)
Q&A (Bảo Hân)
Linux goals
Good programmers typically desire the following characteristics in a system:

1. Simplicity, elegance, and consistency: Programmers prefer their systems to be simple,


elegant, and consistent.

2. Power and flexibility: Programmers seek systems that provide power and flexibility. This
means having a small number of basic elements that can be combined in countless ways to suit
different applications. One of the guiding principles behind Linux is that every program
should do one thing well.

3. Avoidance of unnecessary redundancy: Programmers generally dislike unnecessary redundancy.


Why type 'copy' when 'cp' is sufficient to convey the intended action? Linux aims to eliminate
unnecessary repetition and keep commands concise and understandable.
Processes in Linux
A PROCESS IS AN INSTANCE OF AN EXECUTING PROGRAM.
A PROGRAM IS A FILE CONTAINING A RANGE OF INFORMATION
THAT DESCRIBES HOW TO CONSTRUCT A PROCESS AT RUN
TIME
Fundamental Concepts

Linux is a multiprogramming system


Daemons are special background processes in Linux, initiated by shell scripts during system
boot (ex: cron daemons)
Fork system call: creates an exact copy of the original process (the forking process is called the
parent process. The new process is called the child process)
PIDS: serve as a way to distinguish and manage individual processes
Fundamental Concepts

Process
Message Passing and Pipes: linux allow
communicate between two processes by the
message through pipes
Synchronization in Message Passing
Two processes in Linux that can communicate
with each other:
Shell Pipelines: "sort <file | head,"
Signals
Process-Management System Calls in Linux
Implementation of Processes and Threads in
Linux

* User mode and kernel mode, system calls


* Task_struct: a process is internally represented by the task_struct
structure. Unlike some other operating systems that distinguish between
processes, lightweight processes (threads), and threads, Linux uses the
task_struct to represent any execution context
*Process Descriptor Creation
* PID: idenficate processes
Implementation of Processes and Threads in
Linux
* Copy-on-Write (COW): Is a
way Linux intelligently
manages memory when
creating new processes or
copying data

*Executing New Programs

* Demand Paging
Implementation of Processes and Threads in
Linux

Challenges in Multithreaded Systems


Problems in File /O
Clone
Task identifier (TID)
Scheduling in Linux

Three scheduling purposes:


1. Real-time FIFO.
2. Real-time round robin.
3. Timesharing.
BOOTING
LINUS
BOOTING LINUS

MASTER BOOT RECORD


BIOS AND POST BOOT LOADER
(MBR)

LOADING KERNEL C CODE


THE KERNEL START-UP INITIALIZATION

GETTY USER
INIT PROCESS
AND LOGIN INTERACTION
1. BIOS AND POST

When the computer starts, the BIOS performs


Power-On-Self-Test (POST)
Initial device discovery and initialization,
since the OS’ boot process may rely on access
to disks, screens, keyboards, and so on
2. MASTER BOOT RECORD
(MBR)

The MBR (Master Boot Record): The first sector of the boot disk.
Is read into a fixed memory location and executed.
This sector contains a small (512-byte) program that loads a
standalone program called boot from the boot device, such as a
SATA or SCSI disk.
The boot program first copies itself to a fixed high-memory
address to free up low memory for the operating system.
3. BOOT LOADER

Once moved, boot reads the root directory of the boot device.
GRUB (GRand Unified Bootloader): must understand the file
system and directory format.
Intel’s LILO: do not rely on any specific file system; need a block
map and low-level addresses, which describe physical sectors,
heads, and cylinders, to find the relevant sectors to be loaded.
4. LOADING THE KERNEL

Then boot reads in the operating system kernel


and jumps to it. At this point, it has finished its
job and the kernel is running.
5. KERNEL START-UP

The kernel start-up code is written in assembly language and is


highly machine dependent.
Typical work includes setting up the kernel stack, identifying the
CPU type, calculating the amount of RAM present, disabling
interrupts, enabling the MMU, and finally calling the C-language
main procedure to start the main part of the operating system.
6. C CODE INITIALIZATION

The C code also has considerable initialization to do, but this is


more logical than physical.
It starts out by allocating a message buffer to help debug boot
problems.
As initialization proceeds, messages are written here about what
is happening, so that they can be fished out after a boot failure by
a special diagnostic program.
As the operating system’s cockpit flight recorder (the black box
investigators look for after a plane crash).
7. GETTY AND LOGIN

For each enabled terminal, it forks off a


copy of itself, which does some
housekeeping and then executes a
program called getty.
Getty sets the line speed and other
properties for each line (some of which
may be modems, for example), and then
displays “login:” on the terminal’s screen
and tries to read the user’s name from
the keyboard.

You might also like