Linux System Calls

  Home  Operating System Linux  Linux System Calls


“Linux System Calls frequently Asked Questions by expert members with experience in Linux System Calls. These interview questions and answers on Linux System Calls will help you strengthen your technical skills, prepare for the interviews and quickly revise the concepts. So get preparation for the Linux System Calls job interview”



35 Linux System Calls Questions And Answers

21⟩ What does exec family return?

When successful exec will not return, it will start

executing the new program

However if there is an- error exec returns -1 and sets the

errno to the appropriate value

 109 views

22⟩ What do fork() internally call?

Linux implements fork() via the clone() system call.

The clone() system call, in turn, calls do_fork().

The bulk of the work in forking is handled by do_fork(),

which is defined in kernel/fork.c.This function calls

copy_process() and then starts the process running.

If copy_process() returns successfully, the new child is

woken up and run. Deliberately, the kernel runs the child

process first.

 121 views

24⟩ What is stored at /lib/modules?

It contains all the kernel modules that needed to be loaded

into kernel (booting etc). there will some .map, .dep

(dependency files) files present.

When the kernel needs a feature that is not resident in the

kernel, the kernel module daemon kmod[1] execs modprobe to

load the module in.

You can see what modules are already loaded into the kernel

by running lsmod, which gets its information by reading the

file /proc/modules

 144 views

25⟩ What is stored in /proc?

Mainly hardware related information such as CPU

information, Memory (RAM) information stored under /proc

directory

example:

# cat /proc/cpuinfo (show the information of CPU of that

particular hardware)

# cat /proc/meminfo (show the information of Memory i.e.

RAM of that particular hardware)

 154 views

26⟩ What kind of information the Linux driver modules (.ko ) files has?

kernel 2.6 introduces a new file naming convention: kernel

modules now have a .ko extension (in place of the old .o

extension) which easily distinguishes them from conventional

object files. The reason for this is that they contain an

additional .modinfo section that where additional

information about the module is kept.

Linux program modpost can be used to convert .o files into

.ko files.

 120 views

28⟩ How to use resize2fs, what is the purpose?

resize2fs is only for ext2 filesystem but not ext3.

first unmount the partition

#umount /dev/sda1

#tune2fs -O ^has_journal /dev/sda1 #to remove journal from /dev/sda1

#e2fsck -f /dev/sda1

#resize2fs /dev/sda1 600M #resize the partition

 145 views

29⟩ What is the diff between ssh and telnet?

ssh is secured shell, allows the user to login remotely with more secured.

whereas telnet also same but authentications like passwords, transfers over a network as text mode. so it is not good to use.

 133 views

31⟩ Linux file defaults permition is?

umask value = 022

Without a umask in effect,any file created will have 666

permissions.

666

022

---------

644

---------

A umask of 022 will result in files created with 666 permission.

 129 views

32⟩ What is atomic function and atomic variable?

atomic variables are the variables which can only be

manipulated atomically using atomic APIs. Linux declares

variable as atomic by using the type atomic_t. Basically

used a way to achieve synchronization.

an atomic operation is one which cannot be (or is not)

interrupted by concurrent operations and cannot be broken up

into smaller parts that could be performed by different

processors.

Atomic function is a function which is executed to

completion without interruption. Atomic function can also be

seen as a small critical section which is executed without

interruption, locking.

 118 views

33⟩ What are the different ways the Linux can switch from User Space to Kernel Space & vice-versa?

There are 2 situations when Linux can switch from user Space

to Kernel Space:-

1) by doing System calls

2) When interrupt comes (to handle interrupt)

3) by executing 128 (0x80 ) instruction or doing sysenter

Linux can switch from kernel Space to User space:-

1) process in kernel mode is preempted.

2) After completion of Interrupt handler / System call

3) performing sysexit sys call

 149 views

34⟩ What happens when we do insmod & rmmod in Linux Device Drivers?

insmod: insmod is a tool used to attach a module to the

running linux kernel. This will take the kernel object(.ko)

and takes all executable code and data sections of the .ko

and attach it to the running linux kernel.

rmmod: used to remove or deattach a module code from the

running kernel

 131 views

35⟩ Difference between Raid 1 and Raid 5?

RAID 1 is disk striping. no mirroring no parity. Minimum 2 disks required. If any

One disk fails all the data get lost.

RAID 5 is disk striping with parity. Minimum 3 disks required. if anyone disk fails

Data is safe, if two fails data get lost.

 119 views