In this lecture, we will look at the basic operating system concepts briefly.
These concepts are used in the entire course.
We will talk about them in detail later in this course.
So the first concept is address space.
Address space is the set of addresses that a process can use to address memory.
We will see what the process is in a moment.
In this course, we focus on 64-bit addresses,
each number references a specific address giving us an address space of two to the power of 64 bytes
which is really large.
Also, note that the system we are talking about is byte addressing which means the smallest addressable unit is byte
.
So each address references a storage location which is a byte long.
Within this address space, we can keep part of it for RAM and part for hard disk and some other devices.
So, the address space is normally larger than the physical memory.
The next concept is process. A process is basically a program in execution. Process contains program instructions,
the data the program needs, heap and stack within the address space.
Each process has its address space which process can read and write.
Process also contains other resource such as registers, a list of open files, etc. So a process is like a container
holding all the information in order to run the program.
Here is an example of memory map when process is running, as you see, it includes program instructions,
data and stack,
typically the address is from 0 to max size which can be defined by the OS.
The operating system kernel resides in memory above the max size. The kernel code, data, etc.
When we have multiple processes running on the computer, what happens is that each process has its own address space
,
the program instructions, data, stack are different among processes.
The memory reference within one process does not affect the address space of other processes.
However, the kernel which resides in the higher part of address space are the same across all the processes
.
The operating system kernel includes the essential information about each process, such as process state, etc.
And user programs are not allowed to access data in kernel space.
This brings us operation mode.
There are two modes of operations,
kernel mode and user mode.
The operating system runs in kernel mode.
In this mode, we can execute all the instructions and access all the hardware. The application programs run in user mode
where they can only execute a subset of the instructions
and they cannot access the data in the kernel space.
When a program wants to access data in kernel or hardware, it calls a special set of functions called system calls.
The system call acts as an interface between user programs and the operating system.
When a program calls a system call, the control is transferred to the operating system.
The operating system will perform the operation the program needs and return to the user program
once it is done.