0% found this document useful (0 votes)
9 views3 pages

Understanding UNIX Kernel and Shell Basics

A complete syllabus on unix.

Uploaded by

Mr. Rakesh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Understanding UNIX Kernel and Shell Basics

A complete syllabus on unix.

Uploaded by

Mr. Rakesh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

 What is Kernel and what is Shell?

 Kernel: The kernel is the core part of the UNIX operating system. It manages system
resources and allows other programs to run and use these resources. The kernel
handles memory management, process scheduling, file management, and more.
 Shell: The shell is a command-line interpreter that provides an interface for users to
interact with the operating system. It interprets the commands entered by the user and
communicates with the kernel to execute them. Examples of shells include Bash, C
shell, and Korn shell.

 What are the important system calls in UNIX?

 Some important system calls in UNIX include:


o fork(): Creates a new process by duplicating the existing process.
o exec(): Replaces the current process image with a new process image.
o wait(): Makes the parent process wait until all of its child processes have
terminated.
o open(): Opens a file.
o read(): Reads data from a file.
o write(): Writes data to a file.
o close(): Closes a file descriptor.

 What is internal command and what is external command?

 Internal Command: An internal command is built into the shell itself and does not
require an external executable to run. Examples include cd, echo, pwd, set, and
export.
 External Command: An external command is a separate executable file located in
one of the directories listed in the PATH environment variable. Examples include ls,
grep, awk, sed, and find.

 Describe UNIX file system.

 The UNIX file system is a hierarchical structure consisting of files and directories.
The top of the hierarchy is the root directory, represented by a slash (/). It includes
several important directories like /bin for binary executables, /etc for configuration
files, /home for user home directories, and /var for variable files like logs.

 What are the different types of UNIX file system?

 UNIX file systems include:


o Ordinary files: Regular files containing user data.
o Directories: Special files that contain information about other files.
o Character device files: Represent devices that can be accessed one character
at a time (e.g., terminals).
o Block device files: Represent devices that can be accessed in blocks (e.g.,
hard drives).
o FIFO files: Named pipes used for inter-process communication.
o Socket files: Used for network communication.
 What is absolute pathname and what is relative pathname?

 Absolute Pathname: Specifies a complete path from the root directory. For example,
/home/user/docs/[Link].
 Relative Pathname: Specifies a path relative to the current working directory. For
example, if the current directory is /home/user, a relative path might be
docs/[Link].

 Difference between cd . and cd ..

 cd .: Changes to the current directory (no effect, as it references the current


directory).
 cd ..: Changes to the parent directory of the current directory.

 What are the file attributes?

 File attributes in UNIX include:


o Type: Indicates if it’s a regular file, directory, symbolic link, etc.
o Permissions: Read, write, and execute permissions for owner, group, and
others.
o Links: Number of links to the file.
o Owner: User who owns the file.
o Group: Group that owns the file.
o Size: Size of the file in bytes.
o Timestamp: Last modification, access, and change times.

 What is absolute permission and relative permission?

 Absolute Permission: Permissions set using numeric values (e.g., chmod 755
filename).
 Relative Permission: Permissions set using symbolic notation (e.g., chmod u+x
filename).

 What is Hard link, Soft link and significance link?

 Hard Link: A directory entry that associates a name with a file on a file system. Hard
links share the same inode.
 Soft Link (Symbolic Link): A file that points to another file by name. If the target
file is deleted, the link becomes broken.
 Significance: Hard links cannot span different file systems, while soft links can. Soft
links can also link to directories.

 What is standard output, standard input, and standard error?

 Standard Input (stdin): The default source of input for a program, typically the
keyboard.
 Standard Output (stdout): The default destination for output from a program,
typically the terminal screen.
 Standard Error (stderr): The default destination for error messages, typically the
terminal screen, separate from stdout.

 Write the steps of shell creating.

 The steps for shell creation are:


o init: The initial process started by the kernel that spawns other processes.
o getty: The process that manages physical or virtual terminals and waits for a
user to log in.
o login: The process that handles user authentication.
o shell: The command interpreter that provides the user interface after a
successful login.

 What is background process?

 A background process runs independently of the terminal, allowing the user to


continue other tasks. Background processes are initiated by appending an ampersand
(&) to the command (e.g., sleep 100 &).

 What is zombie state?

 A zombie state refers to a terminated process that still has an entry in the process
table. It occurs when the process has finished execution but its parent has not yet
called wait() to read its exit status.

 How to reduce priority of process?

 The priority of a process can be reduced using the nice command. For example, nice
-n 10 command runs the command with a lower priority.

 What is an environment variable?

 Environment variables are dynamic values that affect the processes or programs on a
computer. They are used to pass information into processes that are spawned from the
shell. Common environment variables include PATH, HOME, USER, and SHELL.

Common questions

Powered by AI

Hard links directly associate a name with a file and share the same inode, meaning they are indistinguishable from the original file. They cannot span across file systems or link to directories. Soft links, or symbolic links, point to a file by name and use a different inode. If the target is deleted, the link breaks. Soft links can traverse different file systems and link to directories, offering greater flexibility .

Absolute pathnames in UNIX specify a complete directory path from the root (e.g., /home/user/docs), ensuring consistent file location regardless of current context. Relative pathnames derive from the current working directory (e.g., docs/file), affecting accessibility by requiring knowledge of the current directory for correct navigation .

In UNIX, fork() creates a new child process by duplicating the existing process. This child process has a unique process ID but shares the parent's memory until exec() is invoked. The exec() system call replaces the current process image with a new process image, enabling the execution of new programs. This interaction allows dynamic process creation and execution, forming the backbone of process management .

The nice command in UNIX modifies process priority, lowering it by increasing the niceness value, thereby reducing CPU usage priority. For example, nice -n 10 command lessens its execution precedence to favor other processes, balancing resource allocation and improving system responsiveness under load .

Environment variables in UNIX provide dynamic values that influence process behavior and configuration. They serve to pass essential information to processes spawned from the shell. Examples include PATH, which defines executable search paths; HOME, pointing to the user's home directory; USER, indicating the current logged-in user; and SHELL, specifying the default shell .

The UNIX kernel manages system resources by handling memory management, process scheduling, and file management, among other duties. Memory management ensures optimal utilization by allocating and deallocating memory to processes. Process scheduling determines the order and time processes are executed, optimizing CPU utilization. File management involves storing, retrieving, and organizing files, which are essential for data manipulation and storage .

A process enters a zombie state when it terminates, but its parent process has not yet read its exit status with wait(). Although the process has finished execution, it remains in a process table entry representing resource usage until the parent retrieves the status, resolving the issue .

UNIX supports multitasking by allowing processes to run in the background, freeing the terminal for other tasks. A background process is initiated by appending an ampersand (&) to the command line (e.g., sleep 100 &), which detaches the process from the terminal's standard input and outputs, allowing the user to execute additional commands concurrently .

Standard input (stdin) typically refers to keyboard input, standard output (stdout) to terminal screen output, and standard error (stderr) to error message display. Stdout and stderr are separable for capturing normal vs. error outputs. Redirection modifies their default targets, allowing inputs from files or outputs to be stored in files for efficient logging and debugging .

The UNIX system follows several key steps: the init process starts at boot time, spawning getty processes that manage terminals. When a user logs in, the login process authenticates them, and upon successful authentication, a shell process is started. This shell provides command interpretation and user interaction with the system .

You might also like