Unix System Architecture and Unix File System Structure
The architecture of this operating system is based on a layered design and has four layers. with each layer providing a specific set of services to the layers above it. The layers are organized in a hierarchical fashion, with the lowest layer providing the most basic services and the upper layers building on these services to provide more advanced functionality. Unix system architecture consists of Hardware, Kernel, System Call interface(shell) commands and utilities, user applications etc.
Structure in Unix has, all files are organized into directories. Files in Unix System are organized into multi-level hierarchy structure known as a directory tree.
The Unix system architecture is based on a layered design,
We will learn below topics in this article:
Unix System Architecture/ Unix structure
A computer system contains hardware and software that controls and manage computer hardware, software resources, and Operating system required for the computer. The operating system acts as the intermediate between hardware and the user-defined application software. Unix is a multitasking, multiuser operating system.
The software is of two types:
- System software
- Application software.
The system software provides platform for other software on the computer. Application Software is user-defined software that works on the system software. An operating system is a system software.
The Unix system architecture is divided by into four layers.
Major components of Unix operating System architecture are :
- Hardware layer
- Commands and Utilities
- User Applications/ Application Layer
The lowest layer of the Unix architecture is the hardware layer, which provides the physical components of the computer, such as the CPU, memory, and disk drives. The hardware layer communicates with the operating system through device drivers, which are software modules that provide a standard interface between the hardware and the operating system.
Kernel is the central core of the operating system that interacts directly with the hardware of the system.
The main functions of Kernel are:
- Computer hardware such as memory, disc, printers are controlled by the kernel.
- The kernel provides a set of basic services, such as process management, memory management, and input/output (I/O) management the processes, control and executes various user-defined tasks.
- The kernel also provides a system call interface, which allows applications to interact with the operating system and access its services.
- Manages the data storage.
It is the interface between the user and the kernel. Users can interact with the shell using shell commands. The shell provides a command-line interface that allows users to interact with the system by entering commands and receiving responses
- Users communicate directly with Shell. Translates user’s commands into functions understandable by Kernel
- It interprets commands given by the users and executes them using the kernel.
- Issues a shell prompt and waits for user response
- Provides programming ability to the users to write shell commands .
The shell also provides a scripting language that allows users to automate common tasks and create more complex programs.
Commands and Utilities
Above the shell are the system utilities, which are a collection of programs that provide additional functionality to the system. System utilities include programs for managing files and directories, networking, printing, and security. Commands used by the Unix operating system are:
- ‘sh’ – shell commands providing a primary user interface,
- There are various commands and utilities which you can make use of in your day to day activities. cp, mv, cat and grep
The top layer of the Unix architecture is the application layer, which includes all the user-level programs that run on the system.
- All the data/programs which the user writes.
- Applications can be developed using a wide range of programming languages, including C, C++, Python, Java, and Perl.
Unix File System Structure
Files in Unix System are organized into multi-level hierarchy structure known as a directory tree. At the top of the file system is a directory called “root” which is represented by a “/”
- A file is a smallest unit in which the information is stored.
- All data in Unix is organized into files. All files are organized into directories. Unix has multiple file systems
- A file system is a formatted partition of the disk ,group of files having relevant information
- There is always one compulsory file system known as the root.
- For more information
Features of the Unix file management system :
- It implements a hierarchical directory structure of the file name space.
- It implements a uniform and consistent treatment of file data and other I/O objects.
- It implements a means of sharing file data.
- It implements a means of protecting file data.
- Keeps track of files using i-node numbers.
- File access permissions can be set 3 classes of users:
- File Owner
- File Owner’s Group
Absolute and Relative Path
What is a Path?A path is a unique location to a file or a folder in a file system of an OS. A path to a file is a combination of / and alpha-numeric characters.
What Is An Absolute Path?An absolute path is defined as specifying the location of a file or directory from the root directory(/). In other words absolute path is a complete path from start of the actual file system from / directory.
Some examples of absolute path:/home/base/myData/test.config /home/base/myData/queries.sql
What Is The Relative Path?Relative path is defined as a path related to the present working directory(pwd). Suppose I am located in /home/base and I want to change directory to /home/base/myData. I can use relative path concept to change directory to myData Changing directory using relative path:
Syntax:$pwd /home/base $cd myData
Change directory using absolute path:$cd /home/base/myData Note: We can use absolute path from any location where as if you want to use relative path we should be present in a directory where we are going to specify relative to that present working directory.
|cd ./myData||Change current directory to myData||Use relative path|
|cd ..||Change current directory to parent directory||Use relative path|
|cd /home/base/myData||Change current directory to dir1||Use absolute path|