[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
Inside-Linux
--------------------------------------
This paper covers Linux internals and gives an overview of what is going on inside Linux.
The Linux kernel is a collection of header files (*). These header files contain all necessary functions, data structures and modules to run Linux.
(*) Comment: No. The Linux kernel is a special type of program controlling the computer and all usual programs. The collection of header files is rather an interface to the kernel for programmers.
The following list shows some of the most important headers of Linux.
The Linux filesystem is different to that of Windows. While Windows distinguishes between files, directories and harddrives, Linux covers all this under the term device.
Devices are one the core concepts in Linux. Virtually anything is regarded as a device. The first harrdrive, /dev/hda1 , is a device, the CD-ROM, /dev/cdrom is a device etc. You can see this is you take a look in your filesystem and you will see entries for your harddisk, cdrom, soundcard, midi, etc.
Another peculiarity of Linux is, that Linux supports multiple filesystems. The most popular filesystems of Linux are: ReiserFS, Ext2 & Ext3. ReiserFS has become a standard today, yet many Linux distributions, like Debian or Knoppix, still use Ext2 or Ext3 as their main filesystem. Ext3 and ReiserFS are better because they are what is called journalled which means that they create an index of files on the disk so that if the system ever fails then it does not take as long to recover since fsck does not need to scan all of the files for errors, it simply consults the index.
Linux is a multiprocessural operating system. That is, under Linux you can run and create more than one process.
Processes can be created in 3 different ways. The first method is called forking . The second method is called exec . The difference between fork and exec is, that, when using exec, the process will not run as a separate, singular thread but within the other existing thread.
That means that this new thread shares the memory with the other thread. fork , in contrast, creates not only a new thread but also uses its own memory space and hence runs as a totally independ thread.
fork and exec are implemented as functions within the <unistd.h> header file.
The third way to create processes is, to use the system() function.
This code snippet calls the Linux program Gnuplot to draw a sinus courve for in an interval of 5 seconds.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
Inside-Linux
Inside Linux
--------------------------------------This paper covers Linux internals and gives an overview of what is going on inside Linux.
The Linux Kernel
The Linux kernel is a collection of header files (*). These header files contain all necessary functions, data structures and modules to run Linux.(*) Comment: No. The Linux kernel is a special type of program controlling the computer and all usual programs. The collection of header files is rather an interface to the kernel for programmers.
The following list shows some of the most important headers of Linux.
<kernel.h> <assert.h> <errno.h> <stdio.h> <unistd.h>
FileSystem & Devices
The Linux filesystem is different to that of Windows. While Windows distinguishes between files, directories and harddrives, Linux covers all this under the term device. Devices are one the core concepts in Linux. Virtually anything is regarded as a device. The first harrdrive, /dev/hda1 , is a device, the CD-ROM, /dev/cdrom is a device etc. You can see this is you take a look in your filesystem and you will see entries for your harddisk, cdrom, soundcard, midi, etc.
Another peculiarity of Linux is, that Linux supports multiple filesystems. The most popular filesystems of Linux are: ReiserFS, Ext2 & Ext3. ReiserFS has become a standard today, yet many Linux distributions, like Debian or Knoppix, still use Ext2 or Ext3 as their main filesystem. Ext3 and ReiserFS are better because they are what is called journalled which means that they create an index of files on the disk so that if the system ever fails then it does not take as long to recover since fsck does not need to scan all of the files for errors, it simply consults the index.
Processes
Linux is a multiprocessural operating system. That is, under Linux you can run and create more than one process. Processes can be created in 3 different ways. The first method is called forking . The second method is called exec . The difference between fork and exec is, that, when using exec, the process will not run as a separate, singular thread but within the other existing thread.
That means that this new thread shares the memory with the other thread. fork , in contrast, creates not only a new thread but also uses its own memory space and hence runs as a totally independ thread.
fork and exec are implemented as functions within the <unistd.h> header file.
/* the exec functions family */ int execl(char* path, char* arg,...); int execlp(char* file, char* arg, ...); int execle(char* path, char* arg,...); int execv(char* path, char *argv[]); int execvp(char* file, char* argv[]); int execve(char* path, char* argv[]); /* the fork function */ int fork();
The third way to create processes is, to use the system() function.
system("echo 'plot sin(x); paus 5' | gnuplot");
This code snippet calls the Linux program Gnuplot to draw a sinus courve for in an interval of 5 seconds.
Shell programs
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
