OC Flashcards
(223 cards)
What is An Operating System? (Two functions)
An operation system is a software that performs 2 functions:
- Extended Machine
- Resource Manager
What is extended machine?
Extends the underlying machine architecture
(instruction set, memory org., I/O, and bus structure)
– E.g., disk driver instead of reading SATA 450-page manual
– Provides abstractions like files and processes
What is a resource manager?
- Manages resources such as CPUs, memories, timers,
disks and NICs - Allocate resources to programs
- Manages concurrent requests to resources, e.g., time
multiplexing on the CPU, space multiplexing on RAM
OS Examples UNIX
OpenBSD, FreeBSD, NetBSD, MacOS
OS Examples LINUX
- Debian (MX, Mint, Ubuntu),
- Redhat (RHEL, Fedora, CentOS)
- Arch (Manjaro)
- Gentoo (Pentoo)
- Android, …
————– not LINUX
Windows
What is the CPU? what is the loop (FDLE)?
The “brain” of the computer
In an infinite loop does:
* Fetch an instruction from memory
* Decode it
* Load its operands (if any) and
* Execute it
What does a CPU have?
-Each CPU has its instruction set: your
phones is completely different from the
one in your laptop
-CPU has a set of registers to store data
about to be used
CPU Registers
- Program Counter contains the address of the
next instruction to execute - Stack Pointer points to the top of the stack in
memory - The stack contains a frame for each function call that
has not returned yet - One frame contains input parameters, local variables,
… - Program Status Word (PSW) is set by
comparison instructions, it contains the condition
code bits
Memory hierarchy (R,C,MM,MD)
Registers, Cache, Main Memory, Magnetic Disk
What is L1 and L2 caching
L1 and L2 cache are small, high-speed memory storage areas that are built into the processor chip of a computer. The purpose of caching is to reduce the time it takes for the processor to access data from the slower main memory, which is usually DRAM (Dynamic Random Access Memory).
L1 cache (primary) is the smallest and fastest cache on the processor chip.
L2 cache (secondary) is a larger cache that is slower than L1 cache but faster than main memory.
Disks: OS as an Extended Machine
read & write: 13 parameters in 9 bytes
1) address of the disk;
2) number of surface;
3) number of cylinder;
4) number of track;
5) kind of recording mode
(continuous, interleaf, …);
6) what to do if the data is not found;
7) …
is the motor on? is the motor off?
Disk Speed
-Platters rotate at 5400, 7200, 10800 RPM
-It takes 1 msec to move the head from one
cylinder to the next
* 5 to 10 msec to move to a random one
-It takes 5 to 10 msec for a sector to be
under the arm
-Reading speeds are in the range of 50 to
160MBps
Booting-up facts
- The PC has a parentboard
- The Basic Input/Output System (BIOS) is
a program stored on the parentboard - BIOS has low-level software to use the
keyboard, screen, disks, etc. - BIOS is stored in flash RAM
BIOS - 6 Steps
- Checks how much RAM is installed and whether the
keyboard, etc., are working (USB, PS/2) - Scans for PCI and PCIe devices and installs them
- Checks in CMOS memory for a list of booting
devices and tries them
- Complementary Metal–Oxide–Semiconductor (CMOS) - Loads the first sector from the booting device
- Runs its code, which normally examines the
partition table at the end of the boot sector to
determine which partition is active - This results in running a secondary boot loader from
that partition which loads the OS
OS Booting up
- Queries the BIOS for the configuration info.
- Detect if the hardware configuration changed
since last restart - For each device, check if it has its driver
OS Types
Mainframe OS
Goliath computer! Heavily oriented toward
processing jobs at the same time
* Offer batch, transaction processing and
timesharing services
* E.g., OS/390, descendent of OS/360
Server OS
* Serve multiple users at once (Web, file printing)
* E.g., Linux server distros, Solaris, FreeBSD,
Windows Server
Multiprocessor OS
* Runs multiple CPUs into a single system
Personal OS
* E.g., Linux, Windows, FreeBSD, OpenBSD
Handheld OS
* E.g., Android
Embedded OS
* Control non-computer devices, e.g., oven
* End-user can’t install software on it
* E.g., Embedded Linux
Sensor-Node OS
* Sensors have limited power
* Run a tiny OS, often event-driven
- Respond to external event, or an internal clock
* E.g., TinyOS
Real-time OS
* Need to perform tasks within limited time
* Tasks are triggered by events
* Hard real-time OS: if an action absolutely
must occur at a certain moment or within a
certain range
-E.g., eCos
-Users can’t add their software
* Soft real-time OS: it’s acceptable, but not
desirable, to occasionally miss a deadline
What is a Process?
A process is a program in execution
A process has its address space
It also has a set of resources:
* Registers (including the program counter and stack pointer)
* List of open files
* Lists of related processes
* etc.
One main task of OS
One of the main tasks of an OS is to
decide which process runs at an instant t
* And in which processor core
-For example, you might be using Firefox
and LibreOffice at the same time on a
single-core machine
After running Firefox for a certain time, the
OS needs to pause Firefox to run LibreOffice
- In order to be able to resume Firefox once
LibreOffice’s time is over, the OS needs to
store the status of Firefox before pausing it:
* Save its address space (core image) as well as
* Other information (registers content, file pointers,
etc.)
- Process information, other than its address
space, is usually stored by the OS in a data
structure inside a process table
What is a linux time slice?
In Linux, the time slice, also known as the time quantum, is the amount of time allocated to a process for it to execute on the CPU. The time slice is determined by the kernel scheduler and can vary depending on the specific system and kernel configuration.
By default, the time slice in Linux is usually around 10 milliseconds (ms)
What happens when “gedit” is entered in shell?
this effectively asks the “shell”
process to create a new process and run “gedit” in it
- In this scenario, “gedit” is a child of “shell”. “shell” is its
parent
- A process could create many processes to help it
perform a complex operation, e.g., multiplication of
large matrices
- Linux processes form a tree
- The parent and children processes need to co- ordinate the work
* They need to use some form of inter-process
communication, e.g., by sending signals
What is a thread?
A thread is one flow (thread) of execution
within a process
A process can have one or more threads
in it
- E.g., LibreOffice
Threads share the same memory space,
making it easier for them to communicate
than different processes
Address Space
A protection mechanism is required to
prevent a program from accessing
another’s space
* Provided by the hardware, managed by OS
- Virtual memory, use the disk as an extension
of the actual physical memory
The address space as an abstraction of
the physical memory
Files
An abstraction of a collection of bytes
Organised into folders
System calls to manipulate both
Notions of
* Path
* Working directory
* File descriptor
*nix special files
- Block: randomly addressable, e.g., disks
- Character: takes input or outputs a text stream
-E.g., keyboard, modem, printers, etc. - Under /dev (e.g., /dev/lp could be a printer)