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 7 of 377
What is user-defined signal handler?
User-defined signal handlers are custom functions that programmers write to override the default behavior when specific signals occur in a program. Signals are software interrupts sent to indicate important events, and they can be handled in two ways: using default signal handlers or user-defined signal handlers. Types of Signal Handlers Default signal handler − Built-in system behavior for each signal type User-defined signal handler − Custom function written by the programmer to handle specific signals User-defined signal handlers allow programs to customize their response to signals rather than relying on default system actions. Different signals ...
Read MoreWhat is default signal handler?
Signals are software interrupts sent to a program to indicate that an important event has occurred. Every signal in Unix-like operating systems can be handled by one of two possible handlers: A default signal handler A user-defined signal handler A Default signal handler is a predefined handler associated with every signal that the kernel automatically invokes when a process receives that signal. When a program doesn't specify custom handling for a particular signal, the operating system uses the default handler to perform a predetermined action. Types of Default Actions Default signal handlers can perform ...
Read MoreWhat is Thread cancellation?
Terminating a thread before it has completed is called thread cancellation. For example, if multiple threads are concurrently searching through a database and one thread returns the result, the remaining threads might be canceled. Another situation occurs when a user presses a stop button on a web browser to halt page loading. Often, a web page loads using several threads — each image is loaded in a separate thread. When the stop button is pressed, all threads loading the page are canceled. A thread that is to be canceled is often referred to as the target thread. Cancellation of ...
Read MoreThread-local storage (TLS)
Thread-local storage (TLS) is a mechanism that allows each thread to maintain its own separate copy of certain data variables. While threads in a process normally share the same memory space, TLS creates private storage areas that are unique to each individual thread, enabling thread-specific data management without the need for explicit synchronization. How Thread-Local Storage Works In a typical multithreaded environment, all threads share the process's global variables and heap memory. However, with TLS, the system creates separate instances of specified variables for each thread. When a thread accesses a TLS variable, it automatically gets its own ...
Read MoreScheduler activations
Scheduler activations is a technique that enables effective communication between the user-thread library and the kernel. This mechanism provides an elegant solution to the problem of managing user threads efficiently while maintaining kernel awareness of thread activities. How Scheduler Activations Work The kernel provides an application with a set of virtual processors (also called Lightweight Processes or LWPs). The application can then schedule user threads onto these available virtual processors. The key innovation is that the kernel must inform the application about certain critical events through a mechanism called upcalls. Scheduler Activations Architecture ...
Read MoreLightweight process (LWP)
Many systems implement either the many-to-many or the two-level model by placing an intermediate data structure between user and kernel threads. This data structure is typically known as a Lightweight Process (LWP) and serves as a virtual processor for scheduling user threads. How Lightweight Processes Work To the user-thread library, the LWP appears to be a virtual processor on which the application can schedule a user thread to run. Each LWP is attached to a kernel thread, and it is the kernel threads that the operating system schedules to run on physical processors. ...
Read MoreData structures of a Windows thread
Windows implements the Windows API, which is the primary API for the family of Microsoft operating systems (Windows 98, NT, 2000, XP, and Windows 7). A Windows application runs as a separate process, and each process may contain one or more threads. Additionally, Windows uses the one-to-one mapping, where each user-level thread maps to an associated kernel thread. Components of a Windows Thread The general components of a thread include − A thread ID uniquely identifying the thread A set of registers representing the status of the processor A user stack, employed when the thread is ...
Read MoreHardware Synchronization
Hardware Synchronization provides solutions to the critical-section problem using atomic hardware instructions. These hardware-based techniques form the foundation for more sophisticated synchronization mechanisms and offer better performance than pure software solutions. Hardware synchronization relies on the premise of locking using atomic operations that cannot be interrupted. These instructions allow us to test and modify memory locations or swap values as one uninterruptible unit, making them ideal for implementing mutual exclusion in multiprocessor environments. Why Hardware Support is Needed In uniprocessor systems, disabling interrupts can solve the critical-section problem by preventing preemption. However, this approach fails in multiprocessor ...
Read MorePeterson's Problem
Peterson's solution provides a good algorithmic description of solving the critical-section problem and illustrates some of the complexities involved in designing software that addresses the requirements of mutual exclusion, progress, and bounded waiting. Peterson's Algorithm Peterson's solution is restricted to two processes that alternate execution between their critical sections and remainder sections. The processes are numbered P0 and P1. We use Pj to denote the other process when Pi is present; that is, j = 1 - i. Shared Data Variables Peterson's solution requires the two processes to share two data items: int turn; ...
Read MoreResuming Process Monitoring for a Process Instance
When multiple processes are suspended on a condition variable x and an x.signal() operation is executed, we must determine which suspended process should be resumed next. A simple solution uses first-come, first-served (FCFS) ordering, where the longest-waiting process is resumed first. However, this approach is often inadequate for complex scheduling requirements. Conditional-Wait Construct The conditional-wait construct provides a more sophisticated scheduling mechanism with the form: x.wait(c); Here, c is an integer expression evaluated when the wait() operation executes. The value of c, called a priority number, is stored with the suspended process name. When ...
Read More