Vladislav Shpilevoy PRO
Database C developer at Tarantool. Backend C++ developer at VirtualMinds.
System programming
Lecture 0:
About the course. History of Unix, Linux. Architectures. Standards.
Version: 3
Vladislav Shpilevoy
vshpilevoi@mail.ru
Marks:
It was given at Moscow State University at CMC faculty as an optional course
Then it was translated to English by me while I worked at Ubisoft
Created as a part of the educational program of the biggest Russian IT company - VK Group
System programming on the whole and in Linux especially
Covers basic themes such as Virtual Memory, File System and Devices, Processes, Multithreading ..., but down to every tiny detail, from userspace to hardware
Contains lots of examples, self-check questions, home tasks, and very detailed lecture notes
After the course you are supposed to actually know how your code works, down to the kernel and transistors.
Books:
Lectures: slides.com/gerold103/decks/sysprog_eng
Any Linux or Mac
What to do with Windows? - Virtualbox option
Step one
Step two
Install Virtualbox
Download an ISO file with Ubuntu or with any other Linux
Step three
Install OS from the ISO file and enjoy Linux
What to do with Windows? - WSL option
Run Powershell terminal.
wsl --install
Reboot with updates installation.
Run Powershell terminal again.
wsl --install -d Ubuntu
Run WSL app (find it in Windows search bar)
Uniplexed Information and Computing Service
Dennis
Ritchie
Kenneth Thompson
Bell Labs
In 1969 Bell Labs abandones the project and creates Unix
Multiplexed Information and Computing Service
1 - Unified process memory
Write
Write
Process memory
void *
mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset);
2 - Dynamic linking
Process memory
.so, .dll, .dylib
PIC - Position Independent Code
mov edx, [ebp+8]
data[]
Data
Code
$> man gcc -fpic ... -fPIC ...
3 - Runtime changes of hardware configuration
4 - Shell
v.shpilevoy$> echo 'hello world'
5 - Security rings
6 - Hierarchical file system
UNIX / eunuchs
Computer to run Multics
1969
Creation
1970
Name
1971
man
1973
AT&T releases Unix System V
1977
Berkeley Software Distribution
1982
Rewritten in C
Unix systems
AT&T sells UNIX
"Unix Wars"
Andrew
Tanenbaum
Linus
Torvalds
Kernel
Environment
Drivers, file system, virtual memory, ...
GUI, compiler, console, libraries, text editors
Linux
"GNU is Not Unix"
Richard Stallman
- Lets write some code, an adventure for a couple of years!
- ALMOST VERSION 1.0!
Torvalds UniX
TUX
Original
IPC
Virtual Memory
Scheduler
Kernel address space
User address space
Keyboard driver
Sound
driver
<mute sound>
Messages through the kernel
Darwin
Mach
Unix
MacOS
iOS
watchOS
tvOS
#Mac
v.shpilevoy$ uname
Darwin
IPC
Virtual Memory
Scheduler
Keyboard driver
Sound
driver
<mute sound>
Call a function in the same process
Kernel address space
User address space
System calls
Research Unix Release 7 | 50 |
4.4BSD | 110 |
System V Release 4 | 120 |
Linux 3.2.0 | 380 |
FreeBSD 8.0 | > 450 |
First Unix | 6 |
System call count
Standards are for portability, compatibility
Uniform Draft Standard 1983
Berkeley Sockets
Nothing is real "Unix" except an old really existing "Unix" system.
Linux, MacOS, Solaris, *BSD - all are slightly (more or less) different variations of kernels, which are Unix-like.
Kernels can be categorised as "monolithic" (one big process) and "micro" (many small processes).
There are standards. For example, both MacOS and Linux follow POSIX standard (like pthreads support). Following a standard means providing certain fixed API with a unified behaviour.
Lectures: slides.com/gerold103/decks/sysprog_eng
Next time:
The kernel. Structure. Process schedulers.
Press on the heart, if like the lecture
By Vladislav Shpilevoy
Linux vs Unix. Microkernel. FreeBSD, Ubuntu, Mac, System III, V, Unix time-sharing system, 4.4BSD. Standard: ISO C, POSIX, Single Unix Specifications. Organisations: Open Group, IEEE.
Database C developer at Tarantool. Backend C++ developer at VirtualMinds.