Drivers Flashcards

1
Q

What are the different ways to Communicate between the Userspace and Kernel ?

A
  • IOCTL
  • Procfs
  • Sysfs
  • Configfs
  • Debugfs
  • Sysctl
  • UDP Sockets
  • Netlink Sockets
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is IOCTL ?

A

IOCTL is referred to as Input and Output Control, which is used to talking to device drivers. This system call, available in most driver categories. The major use of this is in case of handling some specific operations of a device for which the kernel does not have a system call by default.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the differences between kernel module and User programs ?

A

Kernel modules have separate address spaces. A module runs in kernel space. An application runs in userspace. The system software is protected from user programs. Kernel space and user space have their own memory address spaces.

Kernel modules have higher execution privileges. Code that runs in kernel space has greater privilege than code that runs in userspace.

Kernel modules do not execute sequentially. A user program typically executes sequentially and performs a single task from beginning to end. A kernel module does not execute sequentially. A kernel module registers itself in order to serve future requests.

Kernel modules use different header files. Kernel modules require a different set of header files than user programs require.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a device driver ?

A

A device driver is a particular form of software application that is designed to enable interaction with hardware devices. Without the required device driver, the corresponding hardware device fails to work.
A device driver usually communicates with the hardware by means of the communications subsystem or computer bus to which the hardware is connected. Device drivers are operating system-specific and hardware-dependent. A device driver acts as a translator between the hardware device and the programs or operating systems that use it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the three kind of devices ?

A

Character device
Block device
Network device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Linux ?

A

Linux is a free open-source operating system (OS) based on UNIX that was created in 1991 by Linus Torvalds. Users can modify and create variations of the source code, known as distributions, for computers and other devices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Linux is divided in 2 spaces

A

Linux is primarily divided into User Space & Kernel Space. These two components interact through a System Call Interface – which is a predefined and matured interface to Linux Kernel for Userspace applications.

Kernel space is where the kernel (i.e., the core of the operating system) executes (i.e., runs) and provides its services.

User Space is where the user applications are executed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a filesystem driver ?

A

A filesystem driver interprets the contents of a filesystem (which is typically the contents of a disk drive) as files and directories and such. There are lots of different ways of storing files and directories and such on disk drives, on network servers, and in other ways. For each way, you need a filesystem driver. For example, there’s a filesystem driver for the ext2 filesystem type used almost universally on Linux disk drives. There is one for the MS-DOS filesystem too, and one for NFS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a system call ?

A

Userspace programs use system calls to get services from the kernel. For example, there are system calls to read a file, to create a new process, and to shut down the system. Most system calls are integral to the system and very standard, so are always built into the base kernel (no LKM option).

But you can invent a system call of your own and install it as an LKM. Or you can decide you don’t like the way Linux does something and override an existing system call with an LKM of your own.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the major/minor numbers ?

A

he Linux kernel represents character and block devices as pairs of numbers :.

Major number
Traditionally, the major number identifies the driver associated with the device. A major number can also be shared by multiple device drivers. See /proc/devices to find out how major numbers are assigned on a running Linux instance.

Minor Number
The major number is to identify the corresponding driver. Many devices may use the same major number. So we need to assign the number to each device which is using the same major number. So, this is a minor number. In other words, The device driver uses the minor number to distinguish individual physical or logical devices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is an inode ?

A

The inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block locations of the object’s data.[1] File-system object attributes may include metadata (times of last change,[2] access, modification), as well as owner and permission data.[3]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly