User vs Kernel Space and Hardware

  • Kernel Space:

    In a basic definition whenever you do an operation thats needs kernel interaction or kernel code is running means you are running in kernel space and by you means your process or your program. Suppose your program wants to do some system calls like interacting with files, managing network sockets or even managing some process, this all is done in kernel space.

    And whenever it is not it is user space.

Command time:

  • time <command> It tells about how much time the process took in different spaces. User space MM:SS Kernel/System space MM:SS

Example:

$ time ls -la
total 588
drwxr-xr-x  2 user1 user1   4096 Jan 17 07:28 .
drwxr-xr-x 34 user1 user1   4096 Feb 23 05:30 ..
-rwxr-----  1 user1 user1 115348 Jan 17 07:26 libbluetooth3_5.62-2_amd64.deb
-rwxr-----  1 user1 user1  11028 Jan 17 07:26 libndp0_1.6-1+b1_amd64.deb
-rwxr-----  1 user1 user1 447140 Jan 17 07:27 libnm0_1.30.0-2_amd64.deb
-rwxr-----  1 user1 user1  12084 Jan 17 07:27 libteamdctl0_1.31-1_amd64.deb
ls --color=tty -la  0.00s user 0.00s system 86% cpu 0.005 total

Last updated