Found 2065 Articles for Operating System

What are Named Pipes or FIFO in Linux/Unix systems?

Arnab Chakraborty
Updated on 11-Oct-2019 13:23:28

3K+ Views

Pipes were meant for communication between related processes. We Cannot use pipes for unrelated process communication. Then to achieve unrelated processes communication, the simple answer is Named Pipes. Even though this works for related processes, it gives no meaning to use the named pipes for related process communication.Unlike pipe, we can use single named pipe that can be used for two-way communication (communication between the server and the client, plus the client and the server at the same time) as Named Pipe supports bi-directional communication.Another name for named pipe is FIFO (First-In-First-Out). Let us see the system call (mknod()) to ... Read More

Big Endian and Little Endian

Arnab Chakraborty
Updated on 11-Oct-2019 13:15:43

16K+ Views

All computers do not store the bytes that comprise a multi-byte value in the same order. Consider a 16-bit internet that is made up of 2 bytes. Two ways to store this value −Little Endian − In this scheme, low-order byte is stored on the starting address (A) and high-order byte is stored on the next address (A + 1).Big Endian − In this scheme, high-order byte is stored on the starting address (A) and low-order byte is stored on the next address (A + 1).To allow machines with different byte order conventions communicate with each other, the Internet protocols ... Read More

What is Network Port?

Arnab Chakraborty
Updated on 31-Jan-2020 10:55:38

6K+ Views

A port is a physical docking point using which an external device can be connected to the computer. It can also be programmatic docking point through which information flows from a program to the computer or over the Internet.A network port which is provided by the Transport Layer protocols of Internet Protocol suite, such as Transmission Control Protocol (TCP) and User Diagram Protocol (UDP) is a number which serving endpoint communication between two computers.To determine what protocol incoming traffic should be directed to, different port numbers are used. They allow a single host with a single IP address to run ... Read More

How to create a process in Linux?

Arnab Chakraborty
Updated on 31-Jan-2020 10:54:58

11K+ Views

A program loaded into memory and executing is called a process. In simple, a process is a program in execution.Let’s inspect how to create a process in LinuxA new process can be created by the fork() system call. The new process consists of a copy of the address space of the original process. fork() creates new process from existing process. Existing process is called the parent process and the process is created newly is called child process. The function is called from parent process. Both the parent and the child processes continue execution at the instruction after the fork(), the ... Read More

Process Representation in Linux System

Arnab Chakraborty
Updated on 11-Oct-2019 13:06:54

809 Views

Linux can manage the processes in the system, each process is represented by a task_struct C data structure. It is found in the include file in the kernel source-code directory. The task vector is an array of pointers to every task_struct data structure in the system. As well as the normal type of process, Linux supports real time processes. All the required information i.e; the state of the process, scheduling and memory-management information, list of open files, and pointers to the process’s parent and a list of its children and siblings are contained in this structure.A process who creates ... Read More

How does a process look like in memory?

Arnab Chakraborty
Updated on 11-Oct-2019 13:04:47

3K+ Views

A program loaded into memory and executing is called a process. In simple, a process is a program in execution.When a program is created then it is just some pieces of Bytes which is stored in Hard Disk as a passive entity. Then the program starts loading in memory and become an active entity, when a program is double-clicked in windows or entering the name of the executable file on the command line. (i.e. a.out or prog.exe)Let’s look at each memory segment and how does a process look like within memory −Figure: Process in MemoryTEXTA process is more than the ... Read More

Deadlock with mutex locks

Arnab Chakraborty
Updated on 11-Oct-2019 13:01:45

5K+ Views

Deadlock can be occurred in a multithreaded Pthread program using mutex locks. Let’s see how it can be occurred. An unlocked mutex is initialized by the pthread_mutex_init() function.Using pthread_mutex_lock() and pthread_mutex_unlock() Mutex locks are acquired and released. If a thread try to acquire a locked mutex, the call to pthread_mutex_lock() blocks the thread until the owner of the mutex lock invokes pthread_mutex_unlock().Let’s take an example, two Mutex locks are created in the following Code −/* Create and initialize the mutex locks */ pthread mutex t mutex1; pthread mutex t mutex2; pthread mutex init(&mutex1, NULL); pthread mutex init(&mutex2, NULL);Next, two threads ... Read More

Transactional memory

Arnab Chakraborty
Updated on 11-Oct-2019 12:58:19

690 Views

Transactional memory originated in database theory, provides an alternative strategy for process synchronization.A memory transaction is atomic is a sequence of memory read–write operations. The memory transaction is committed, if all operations in a transaction are completed. Otherwise, the operations must be aborted and rolled back. The ease of transactional memory can be obtained through features added to a programming language. Consider an example. Suppose we have a function update() that modifies shared data. Traditionally, this function would be written using mutex locks (or semaphores) such as the following −void update (){    acquire(); /* modify shared data */   ... Read More

Process Synchronization in Solaris

Arnab Chakraborty
Updated on 11-Oct-2019 12:56:30

1K+ Views

Solaris implements variety of locks to support multitasking, multithreading and multiprocessing. It uses adaptive mutexes, conditional variables, semaphores, read-write locks, turnstiles to control access to critical sections.An adaptive mutex uses for protecting every critical data item which are only accessed by short code segments.On A multiprocessor system it starts as a standard semaphore spin-lock. If the lock is held by a thread which is running on another CPU then the thread spins. If the lock is held by a thread which is currently in run state, the thread blocks, going to sleep until it is awakened by the signal of ... Read More

Process Synchronization in Windows

Arnab Chakraborty
Updated on 11-Oct-2019 12:53:41

2K+ Views

Windows operating system is a multithreaded kernel that provide support for real time application and multiprocessors. On uniprocessor system, Windows provides interrupt masks to protect access to global resources. It protects access to global resource using spinlock. The kernel uses spinlocks only to protect short code segment like Solaris. The kernel ensures that while holding a spinlock, a thread will never be preempted.Windows provide dispatcher object for thread synchronization according to several different mechanisms including mutexes, semaphores, events and timers. The system protects shared data by requiring a thread to gain ownership of a mutex for accessing the data and ... Read More

Advertisements