*c^2 Crash Course.
Introduction to Linux Kernel:-
Multics —> Unix —> Linux.
Dennis Ritchie and Ken Thompson started with an multiuser OS project in MIT with Bell Laboratories and GE, which failed and then got terminated. That was Multics back then in 1969.
Unix grew out of Multics. Bell Lab programmers had plans for a new file system design for PDP-7 computer which later evolved in to Unix. Which then they ported to PDP11 and re-written in C. The first most widely used Unix OS was Unix Systems, Sixth edition called V6.
Which then was distributed among organisations with source code and which then modified and ported for devices and led to further development. University of California at Berkeley, was one of the major contributor they had their own variant of Unix under name Berkeley Software Distribution(BSD). This was around 1978.
Today, Unix is a modern operating system supporting preemptive multitasking, multi-threading, virtual memory, demand paging, shared libraries with demand loading, and TCP/IP networking. Many Unix variants scale to hundreds of processors, whereas other Unix systems run on small, embedded devices.
Linus began by writing a simple terminal emulator (for new Intel 80386 microprocessor), which he used to connect to larger Unix systems at his school. Over the course of the academic year, his terminal emulator evolved and improved. Before long, Linus had an immature but full-fledged Unix on his hands. He posted an early release to the Internet in late 1991. And Linux took off.
Fast forward to the present.Today, Linux is a full-fledged operating system also running on Alpha, ARM, PowerPC, SPARC, x86-64 and many other architectures. It runs on systems as small as a watch to machines as large as room-filling super-computer clusters.
Whoof *sweats*. So the post title says Linux something something. And then first thing you read is boring history stuff, that has nothing to with tech concepts or programming..eh. Well this is a Linux Kernel Crash Course. I very well understand c^2 are supposed to be lean but then I thought its important to give reader a bigger picture How it started, and contributions and where it is now. My name is Brian doofus(that's a lie my name is Hardik and no don't think of bananas just yet) and I'll be posting series of condensed posts on Linux Kernel and how as a reader you can dig into it, understand it better and then develop/improve things. The way I'm doing it is, I'm reading Linux Kernel Development by Robert Love and side by side taking notes and posting them up and I'm more of a practical person so there's gonna be code loads of it. Takilllyaa.
Kernel:- It is the core internals; the software that provides basic services for all other parts of the system, manages hardware,and distributes system resources.
CPU RAM Peripherals(USB, UART, SPI, PCI, Ehernet, etc.)
Core components of a kernel:-
Interrupt handlers to handle interrupt requests,
Scheduler to share CPU b/w multiple processes,
System services like sharing of resources, inter process communication,
and device drivers, I/O requests and networking,
Way you are able to read this article is because some fella somewhere or team of fellas somewhere sitting on bean bag took the time to write device driver for the L.C.D display of your computer. You have an LCD display. There has to be a way to communicate with the LCD, via HDMI or D Sub or mahbe SPI. One first writes drivers to communicate with the LCD, then configures it according to the use, and then writes application code to draw square's and circles. So its not just the LCD, even Wifi, LAN, USB, BMS, etc.
Applications running on the system communicate with the kernel via system calls.
Kernel deals with all the hardware and stuff, now if application requires to do something with the hardware, it can’t do it directly there’d be a system call.
So here's a problem statement I give you: In C. You have a pointer and you allocate that pointer some chunk of memory. Like this uint32_t *some_ptr = NULL; some_ptr = ( uint32_t * ) malloc( 2 * sizeof(uint32_t) ); if(NULL == some_ptr) return (-1); Pointer you declared above is your resource. Which you might want to share with some thread or maybe not. so two questions popped up in my head. How do you share the resource? and, How do you protect it from unwanted access? well sharing is pretty simple, keep things generic and use void pointers, its just that to whom you share it with must know its data type and must typecast it before use. But how do you protect? Now for above two tasks we require Memory management Unit, which allows different address spaces for Kernel code and application code(different memory spaces for threads/processes).
Two types of Kernel:-
I’m hoping reader is familiar with git, if naut better get used to it its really useful in collaborative development and maintaining versions.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Let’s have a look at kernel source tree:-
One can see drivers, file system, init, ipc, kernel, and mm. Which are all core part’s of the kernel.
****~**~*~**END OF FIRST ARTICLE**~*~**~****
* Linux Kernel c^2 pt. 2 – Process Management. *