Fundamental Concepts
- You should read chapter 2 of the book.
- A quote from Wikipedia while working on these notes "While the adoption on desktop computers is low, Linux-based operating systems dominate nearly every other segment of computing, from mobile devices to mainframes. As of November 2016, all but two of the world's 500 most powerful supercomputers run Linux. The other two run AIX on IBM power 7 hardware."
- He provides two definitions of an operating system
- The program that manages the resources of a computer
- In our terms, this will be the kernel.
- As we have mentioned before, it
- Manages the CPU (or CPUS) allowing programs access to this resource.
- Provides a file system
- Provides memory management
- Device Management
- Supports System Calls (The thing we are most interested in)
- User and system protection
- Interprocess communications.
- And much more.
- In a very real sense, the kernel is loaded as THE Program running on the hardware.
- Everything else is a subroutine.
- Want to see it?
- ls /boot on most systems.
- It is a a compressed executable
- vmlinuz-*
- The second definition is
- The kernel, along with support packages
- A shell
- Other systems utilities: almost any other command you might run.
- A base set of applications (but this is somewhat open to debate)
- Is solitaire required for an OS?
- A Graphical user interface (possibly)
- This is you linux "distribution", or version of unix.
- Some terms
- A process is a program which is running on a computer.
- The scheduler is a portion of the kernel which selects which process will be allowed access to the CPU.
- The kernel supports multitasking or the appearance that multiple processes are running on the CPU at the same time.
- More realistic, the kernel supports multiple processors.
- The scheduler is preemptive.
- Each process is given a time slice or quantum in which
it is allowed to execute.
- Once the quantum is exceeded, the scheduler causes interrupts the process
- At this point, the process is changed to a waiting state.
- And the scheduler selects the next available process to be executed.
- There are a number of ways the scheduler can perform this task.
- Round robin scheduling generally means the scheduler keeps a queue of ready tasks and selects the task off of the front of the ready queue.
- Priority scheduling means that the ready task with the highest priority is selected to run next.
- Linux has a combination of priorities and round robin scheduling
- There are a number of priority queues.
- See nice and renice.
- and also sched_setscheduler, (I have never messed with this but I might give it a try later ...)
- You can monitor the processes on a system using
- ps with various arguments, but on every system.
- top is interactive, and is sometimes an add on.
- A process accesses the services of the kernel through the Application Programming Interface or API.
- This is commonly referred to as making a system call.
- As a side note, the system call is a primary mechanism for running processes to be interrupted and be moved to a waiting state.
- A system call generally means a request for data.
- This will cause a process to be blocked
- Which means it can no longer make progress.
- Which means it should be swapped out, to allow a process that can make progress run.
- Related to this ideas is the mode the CPU is operating in.
- In user mode
- access to instructions, memory and other resources are limited.
- This is the default mode for a process.
- In kernel mode or supervisor mode
- Full access to all memory, instructions and resources is available.
- It requires a system call to switch from user mode to supervisor mode.