Kernel and User Spaces
Start course
1h 43m

Red Hat Enterprise Linux (RHEL) is a rock solid commercial grade Linux operating system. If you're interested in learning RHEL from a system admins perspective then this course is for you!

The "Red Hat Enterprise Linux Technical Overview" course walks you through many of the basic system admin tasks and concepts required to administer RHEL effectively.

This course will provide you with insights to:

  • Working with the Terminal
  • Understanding the Kernel and User Spaces
  • Graphical User Interface
  • File management and the File System Hierarchy
  • Editing Files using Vim
  • Organizing Users and Groups
  • File Permissions
  • Managing Software
  • Configuring Networking
  • Controlling System Startup Processes
  • Introduction to Containers
  • Overview of Cockpit

Have you ever heard about user and kernel spaces? If not, you're at the right place.

The kernel is the heart of the Linux Operating System, and it's responsible for scheduling running programs, file management, and security.

If you have a device driver, it's running in the kernel where is networking implemented? In the kernel. This is what we mean, when we refer to kernel space. The kernel's job is also to support user programs, which run in user space like the shell, like a web browser, or similar programs.

User space programs interact with a kernel through special devices or system calls that they make. An individually running program is called the process and each process has its own private virtual memory space. It runs as a particular user and a set of groups, so that it can access files on the file system.

A process also has a state, that describes whether it is currently running, waiting to run, or whether it is blocked waiting for other resources. How we identify processes would be by its unique ID which we commonly call a PID.

Now there are different types of processes on a Linux System, we have user processes and they're generally associated with a particular user they're started by being run from the shell prompt and therefore associated with the terminal, they print the output to a terminal and they get the input from a terminal.

If they're getting input from a terminal, we call that a foreground process, because they control the shell prompt. It's possible for a process to be put in the background in which case they are not going to be taking input from the terminal, but they can display output to the terminal. Now we have a second class of processes called demon processes and these are processes that are not associated with the terminal at all. They are started up at the system and provide things like networking services or do other special housekeeping tasks to keep the system running. And then we have a third class of processes called kernel threads.

Now these are part of the kernel that are running as if they were regular user processes or system demons, but are not associated with the terminal.

There are parts of the kernel but they are still scheduled as if there were regular processes.

Now we can get information about the processes running in a system by using the ps command. So if I just type in ps on its own like this.

It will get information about the processes are currently associated with my shell.

And you can see that I've got two processes over here.

Here we have the PID or the process ID. You can see the tele type of the terminal (TTY).

So this is running below pts, which stands for sudo terminal session and you can see that, it's running below pts/1. You can see how much compete time is consumed and then the command that represents this particular process ID. So again I've got two processes, but surely this is not all the processes that are running on the system and the answer is no, it's definitely not. So what I could do is that I can make use of options to get more information about the processes running on my system.

So I'm going to use ps -ef and again I'm making use of two options over here and I've got a whole lot of different information over here.

So let's go all the way to the top. Now what the e does is that it shows me information about all processes, the f will give me detailed information would give me a lot of different columns that I could utilize.

So just going through some of them over here, you can see that I've got some processes that are running with the privileges of the user routes. you could see their process IDs, you can see the PPID as well,

PPID stands for parent process ID. Not important at this stage.

However what I want you to focus on right now is the question mark (?) below the TTY column.

And this is telling us that this is a process that is running as a daemon.

It's not attached to a terminal, also what we could see over here is we have a number of commands that are being executed and you may be wondering what the deal is with the commands in square brackets.

Remember, I told you about that third class of processes called kernel threads that's exactly what they are. So they still appear in the output of the ps command, but the visual indicator would be the encapsulation of that thread in a square brackets.

So guys, that's a basic overview of processes and kernel and User Spaces on your system. I will see you in the next video.

About the Author
Learning Paths

Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.

He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.

Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).

Covered Topics