Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Arnab Chakraborty
Page 2 of 377
Concept of Address Split in OS
Address splitting is a memory management technique used in operating systems to divide the virtual address space of processes into distinct logical segments. This approach enables efficient memory allocation, enhanced security through access control, and improved system performance by organizing memory into manageable units with specific purposes. Memory Segmentation Memory segmentation divides the process address space into logical segments such as code, data, stack, and heap segments. Each segment serves a specific purpose and can have different access permissions and sizes based on process requirements. Process Address Space Segmentation ...
Read MoreTransactional memory
Transactional memory originated in database theory and provides an alternative strategy for process synchronization. It allows multiple operations on shared data to be grouped together and executed atomically, without the complexity of traditional locking mechanisms. A memory transaction is an atomic sequence of memory read-write operations. If all operations in a transaction complete successfully, the transaction is committed. Otherwise, the operations must be aborted and rolled back to maintain data consistency. Traditional Locking vs Transactional Memory Consider a function update() that modifies shared data. Traditionally, this function would use mutex locks or semaphores: void update() ...
Read MoreDeadlock with mutex locks
Deadlock can occur in multithreaded Pthread programs when multiple threads compete for mutex locks in conflicting orders. This happens when threads acquire locks in different sequences, potentially creating a circular dependency where each thread waits for resources held by others. Mutex Lock Initialization An unlocked mutex is initialized using the pthread_mutex_init() function. Threads acquire and release mutex locks using pthread_mutex_lock() and pthread_mutex_unlock() respectively. If a thread attempts to acquire an already locked mutex, the call to pthread_mutex_lock() blocks the thread until the owner releases the lock. Example − Deadlock Scenario Consider the following example where two ...
Read MoreHow does a process look like in memory?
A process is a program loaded into memory and executing. When a program is created, it exists as bytes stored on the hard disk as a passive entity. The program becomes an active process when loaded into memory — either by double-clicking in Windows or entering the executable name on the command line (e.g., a.out or prog.exe). A process in memory consists of several distinct segments, each serving a specific purpose during program execution. Process Memory Layout STACK (High Address) Grows Down ...
Read MoreProcess Representation in Linux System
Linux manages processes using a fundamental data structure called task_struct, which contains all the information needed to represent a process in the system. This structure is defined in the header file within the kernel source code. Process Data Structure The task_struct is a comprehensive C structure that holds critical information about each process, including: Process state − Current execution state (running, waiting, stopped) Scheduling information − Priority, time slices, and scheduler-specific data Memory management − Virtual memory layout and page tables File descriptors − List of open files and I/O resources Process relationships − Parent, ...
Read MoreHow to create a process in Linux?
A process is a program loaded into memory and currently executing. In simple terms, a process is a program in execution state that the operating system manages and schedules for CPU time. Creating Processes with fork() System Call In Linux, a new process is created using the fork() system call. This system call creates a new process by making an exact copy of the calling process's address space. The original process becomes the parent process, while the newly created process becomes the child process. When fork() is called, both parent and child processes continue execution from the ...
Read MoreBig Endian and Little Endian
Big Endian and Little Endian are two different ways that computer systems store multi-byte values in memory. The terms refer to which byte (most significant or least significant) is stored first in a sequence of memory addresses. Byte Order Storage Methods Little Endian − The least significant byte (low-order byte) is stored at the starting address (A), and the most significant byte (high-order byte) is stored at the next address (A + 1). Big Endian − The most significant byte (high-order byte) is stored at the starting address (A), and the least significant byte (low-order byte) is ...
Read MoreWhat are Named Pipes or FIFO in Linux/Unix systems?
Named Pipes (also called FIFO - First-In-First-Out) are a mechanism for inter-process communication (IPC) in Linux/Unix systems that allows unrelated processes to communicate with each other. Unlike anonymous pipes, which work only between parent and child processes, named pipes create a special file on the filesystem that can be accessed by any process with appropriate permissions. Named pipes support bidirectional communication, meaning data can flow in both directions through a single pipe, making them more versatile than regular pipes for complex communication scenarios. Creating Named Pipes There are two primary ways to create named pipes in Linux/Unix ...
Read MoreInit process on UNIX and Linux systems
The Init process is the parent of all processes in UNIX and Linux systems, executed by the kernel during system boot. Its primary role is to create processes from configuration stored in /etc/inittab. Init spawns getty processes on terminal lines for user logins and controls all autonomous system processes required for proper operation. After reading /etc/inittab, init determines how the system should be configured for each runlevel and sets the default runlevel. Init then starts all background processes after establishing the system's operational state. Process Hierarchy Process Tree Structure ...
Read MoreLinux Process Monitoring
In Linux, the top command is a powerful utility used to monitor running processes in real-time. It displays an ordered list of active processes and updates regularly, showing critical system information like CPU usage, memory consumption, swap memory, cache size, buffer size, process IDs (PIDs), users, and commands. This tool is essential for system administrators to identify processes consuming high memory and CPU resources. How Top Command Works The top command provides a dynamic view of the system's running processes. It refreshes every few seconds by default and sorts processes by CPU usage, with the most resource-intensive processes ...
Read More