linux

Scheduling in Linux Kernel

linux
linux, kernel, scheduler

There are two ways that you can set priorities in scheduling. sched_setscheduler sched_getscheduler You can do man sched_setscheduler to know more. sched_setscheduler sets scheduling policy and parameters. The other option is to use setpriority- This sets the nice value. A brief guide to priority and nice value In Linux system priorities are 0 to 139 in which 0 to 99 for real-time and 100 to 139 for users. Nice value — Nice values are user-space values that we can use to control the priority of a process. ...

Writing a KVM client

linux
linux, kernel, kvm

Major steps required in the workflow # Open /dev/kvm Obtain KVM API version Check extension if Needed Create a virtual machines Allocate memory for the virtual machines Create virtual CPUs Initialize registers Run guest code The documentation for KVM API is available at Link. The KVM provides an API via a special node /device/kvm. We use this node and ioctl interface to communicate and setup the VM. The ioctl’s can be differentiated into KVM System API, Virtual machine API, vCPU API and device API The /dev/kvm node is used to control the KVM system and to create new VM’s. ...

Synchronization in Linux Kernel

linux
linux, kernel, synchronization

Introduction # This is my understanding of Synchronization concepts in the Linux Kernel. The need for synchronization? # Imagine that there are multiple threads that are trying to write to a global/shared data at a given point in time. Which thread is going to update the data first? What happens to shared data in case of a race condition? So how do we guarantee that in the case of concurrent execution the writable shared data is accessed by only one thread? ...

Atomicity and Atomic Instructions in Linux

linux
linux, kernel, synchronization

Introduction # This is my understanding of Synchronization concepts in the Linux Kernel. The need for synchronization? # Imagine that there are multiple threads that are trying to write to a global/shared data at a given point in time. Which thread is going to update the data first? What happens to shared data in case of a race condition? So how do we guarantee that in the case of concurrent execution the writable shared data is accessed by only one thread? ...

Atomicity and Atomic Instructions in Linux

linux
linux, kernel, synchronization

Introduction # This is my understanding of Synchronization concepts in the Linux Kernel. The need for synchronization? # Imagine that there are multiple threads that are trying to write to a global/shared data at a given point in time. Which thread is going to update the data first? What happens to shared data in case of a race condition? So how do we guarantee that in the case of concurrent execution the writable shared data is accessed by only one thread? ...

Memory Management in Linux Kernel

linux
linux, kernel, Memory

Introduction # When we say Memory Management in Linux Kernel, there are two parts to it. You have one set of memory management files inside respective architecture folders (low level mm) and one on the top of linux kernel (high level mm). Then ones inside the arch specific folders are memory initializers, these are processor dependent and mm folder at the root of the kernel is the memory manager which is processor independent. ...