week 4 - L1 - Linux Operating System Flashcards
The Linux OS comprise a number of elements. What are they?
Bootloader Daemons Shell Graphical Server Kernel Desktop Environment
Bootloader
- what is it?
- is it part of the kernel?
- Bootloader – software that manages the boot process of a computer
- (not part of the kernel)
o Ex the dual-boot in labs that make you choose between windows and linux)
Kernel
- Kernel – (lowest level) core of the operating system
o Manages the CPU, memory and peripheral devices
Daemons
- what are they?
- when do they start?
- Daemons – the background service (like printing or sound scheduling)
o They either start during the boot OR after you log in the desktop
Shell
- Shell – command line interface (CLI)
o (basically terminal where you write code)
Graphical Interface
- what does it display?
- Graphical Server – sub-system that displays the graphics on the monitor (Wayland or X)
o Basically display the graphics on the monitor
Desktop Environment
- Desktop Environment – user interface* such as GNOME, KDE, XFCE
Multi-tasking
- Linux and other Unix-like operating system have been designed from the ground up as complete time sharing systems, that is, as both multitasking and multi-user systems.
- A multitasking system: allows multiple processes to operate seemingly simultaneous without interfering with each other
Multiuser
- A multi-user system: allows multiple users to use the system at the same time, with each having the illusion they’re the only ones using it (they’re the sole user)
Linux layers
- what are the 3?
- what do each of them do?
- more about them:
- what time of control over CPU does the kernel have? what about the processes?
User Space
Kernel
Hardware
User space: Shell, GUI, Web Browser
Kernel: Memory Management, Process Management, Network stack, Device Drivers, System calls
Hardware: CPU, RAM, Hard drive, Network Card
Hardware
– CPU, memory, storage, network interfaces
Kernel
– Core of the OS responsible for managing processes, memory and device hardware
– unrestricted access to the CPU and memory
User space
- Consisting of processes (running programs) that the kernel manages
- restricted access to memory and safe CPU operations
Process
- what is it?
- what does it consist of?
- what does each process have? what do we use to identify it?
- who schedules the process to run on a CPU?
- what happens to the processes and CPU time? and what is it known as
An execution/instance of a program (task)
- is the basic unit of EXECUTION in a Linux OS
A process consists of the code and data (in memory) to run
A process has a PROCESS IDENTIFIER (PID)
The kernel schedules the process to run on a CPU
CPU time is distributed between running processes, which is known as scheduling
o Other processes may be swapped to swap space on persistent storage or suspended
what does the userspace contain?
what does the kernel contain?
what does the Hardware contain?
User Space:
- User Applications,
- GNU C library
Kernel Space:
- System call interfaces,
- Generic call interfaces,
- Architecture Dependent Kernel Code
Hardware:
- CPU
- Memory
user and kernel space
- what memory space does the process occupy? what about the kernel?
- what happens in the userspace?
- what must happen to the address space used by the kernel?
- how does the userspace communicate with the kernel?
- each process occupies its own virtual memory space
- the kernel occupies a single protected address space
- user space is where the processes are executed
- it also contains the GNU C library (glibc) shared by many processes
the address space used by the kernel must be protected from the applications that run in user space
userspace uses system calls to communicate with the kernel
the system call interface provides a means to perform function calls from user space into the kernel (i.e. read and write)
about the processing scheduling algorithm
- how is it?
- what about the code to switch processor contexts?
- what does the scheduler choose?
The scheduling algorithm is generic
The code to switch processor context is not generic, because each CPU architecture has its own registers
The scheduler chooses the next process to run and then calls the architecture-specific code to apply the context switch
what are the components of the kernel?
basically what we learned in he last weeks, the lecture titles
System call interface Memory management Process management Virtual file system Device drivers
what are the main responsabilities of the kernel?
- process and thread creation and termonation
- CPU scheduling
- Signal handling
process management
- what does it refer to? regarding the CPU
- what is the changing of processes on CPU called?
- PROCESS MANAGEMENT
o The execution and scheduling of processes on the CPU
o Context switching
memory management?
- chunks?
- swapping?
- page fault?
- MEMORY MANAGEMENT
o The memory is managed in chunks called pages
o Swapping – moving pages from RAM onto disk to free up space
o Tracking page faults – this occurs when a process accesses one of its pages that is not resident in physical memory RAM
Scheduling
- what is it used for? regarding the processes?
- Scheduling is used to allow processes to share CPU resources
o Basically so all the processes can use the CPU
scheduling is basically scheduling processes to run on the CPU
Context switching
- what happens to the processes and control of the CPU
- what are the steps?
- what must the kernel do in a multi-CPU- system?
- Context Switching – one process gives control of the CPU to another process
- Kernel interrupts the current process running on CPU (interrupts can be triggered by timers)
- Kernel records the current state of the CPU (i.e. program counter and registers) and memory required for resuming the process that has been interrupted
- Kernel performs housekeeping tasks (e.g. collecting data from I/O)
- Kernel now ready to run another process and prepares CPU
- Kernel tells the CPU the time-slice duration to run the next process
- Kernel switches the CPU into user mode and hands control to the new process
- With multi-CPU systems – the kernel needs to maximize the use of all available CPUs
signals
- when do they occur?
- what can the kernel use the signal for?
- when can the signals be handled by the process?
- what sources can generate signals?
Signals are generated when an event occurs that requires attention (when something happens basically that needs to be solved)
be thought of as the software version of hardware interrupts
The kernel can use the signal for example to kill a process
The process can handle the signal if it has declared a SIGNAL HANDLER IN ADVANCE
signals can be generated by:
- Hardware
- System Kernel
- Other processes
- User
o Hardware – Example: division by zero, address protection (this are errors)
o System Kernel – Example: notifying the I/O devices for which a process has been waiting that is available
o Other processes – Example: a child process notifying its parent that is has terminated
o User – Example: pressing a keyboard sequence (ctrl + c) that raises a terminate signal
memory management
- name for the memory of a process
- what is it divided in? what size do they have?
- what illusion is produced by virtual memory?
- what’s physical memory divided into?
- what does each process have? what does it store?
- what needs to happen so that a process is able to exceed it’s memory?
Memory management
Virtual memory – kernel memory management
- The memory space of a process is described as virtual (construct provided by the kernel) rather than physical memory that only the kernel sees
- Virtual memory is divided into chunks called pages (4096 bytes, or 4kB for most architecture)
- Virtual memory gives a process the illusion that it has its own address space that is protected from other processes, which means that a process cannot peak into other processes virtual memory
- Physical memory is divided into page frames
o They are the same size as process pages (4096bytes) - Each process has a page table which maps virtual( also called logical) page numbers to physical RAM frame numbers
o Basically connects virtual memory to physical memory - A process virtual memory address can exceed the physically installed memory as the kernel can enable the process to continue by moving pages around, by storing pages of a process that are currently not being used on disk instead of physical RAM
swapping
- when does it happen?
- how does it work?
- what is swap space?
- what can the swap space be?
When physical memory is exhausted
pages are moved out of the physical memory aka RAM onto the disk
RAM -> disk
- Swap space in Linux is used when the amount of physical memory(RAM) is full
- Swap space can be a dedicated swap partition, a swap file, or a combination of both
File management
- where does the virtual file system sit?
- what does it allow?
- what is the Linux filesystem organized in?
- underneath the file system, files are represented in …?
- what information about the file do these things contain?
File management / Virtual file system
- The virtual file system is a layer that sits on top of an actual file system and which allows a user to access different types of file systems
o Macro basically, and let you choose which type of file system
- The Linux file system is organised into directories for easy navigation and use
- Underneath the file system, files are represented by inodes
o All the information related to the file are represented by inodes - Inodes contains metadata such as:
o Location: pointer to file location on system
o Size: current file size
o Protection: controls who can read, write etc.
o Time, date: for usage monitoring