WHAT IS UNIX?
The essentials of a UNIX or UNIX-like operating system consist of a 'kernel' and 'system programs'. In addition there also are the 'application program' for helping specific user tasks.
A kernel constiture the heart of the OS, and perform severl low level chores like keeping track of the files on disk, starting and running the programs, managing resources for the processes, communicate by exchanging packets of information with the network etc. Another way to look at Kernel is to think of it as an interface between the hardware and users. It prevents the direct access to hardware, and force the processes to do so using the tools (System Calls) provided by it.
The System Calls provided by Kernel are used by System Programs in order to implement various facilities provided by the operating system. A "mount" command is an example of the System program. The Application Programs can also user the System Calls but they are not System Programs because the intent here is to assist user in one of his tasks and not to get the system working.
The line between what is a system call and what is an application is not sharp and there are several programs which can be midway between the two.
The UNIX/UNIX-like OS provide several services some of which we shall list here:
- The "first" Process: init
- Logins from terminals: getty+login
- System Logs: syslog
- Periodic command executon: cron, at service
- Graphical User Interface: X Window System
- Networking Support
- Network Logins: telnet, rlogin, ssh
- Network File Systems: NFS (Supported by Kernel),CIFS
- Electronic mail, Printer Support.
- Executable programs or shell commands
- System calls (functions provided by the kernel)
- Library calls (functions within program libraries)
- Special files (usually found in /dev)
- File formats and conventions eg /etc/passwd
- Games
- Miscellaneous (including macro packages and conventions)
- System administration commands (usually only for root)
- Kernel routines [Non standard]
BASIC TERMINOLOGY OF UNIX SYSTEM PROGRAMMING
We shall follow a very concise approach with less talk and more programming. But before we begin it will be worthwhile to have a look at following terms:- File: A near good definition of a file in UNIX system that that its an object residing either on external or internal memmory, that can be written to, or read from or both.
- File System: The file system refers to tree like hierarchy into which the files are organised in UNIX.
- Directories: The directories are special files that represent the nodes of the file-hierarchy and appear to the user as if they contain other files. But in reality it containscontain directory entries, which are the objects who associate a file to its filename - thus making an impression that actual files reside there.
- Processes: Although we shall discuss the idea of what a process is in detail, it shall suffice to note here that it is an instance of running a program. Each process has an 'id' number called "pid" as well as a 'parent-process-id' called "ppid", about both of which we shall talk more later.
Now that we have some idea of what involves in our endeavor to start with UNIX/LINUX system programming, its time to start!!
A "HELLO SYSTEMS WORLD" PROGRAM
Here's our first program which will print a simple message on to the terminal.
#include |
man 2 write |
Library: #include |
No comments:
Post a Comment