Found 2065 Articles for Operating System

What is Thread cancellation?

Arnab Chakraborty
Updated on 31-Jan-2020 11:07:24

4K+ Views

Terminating a thread before it has completed is called Thread cancellation. For an example, if multiple threads are concurrently searching through a database and one thread returns the result, the remaining threads might be canceled. Another situation might be occurred when a user presses a button on a web browser that stops a web page from loading any further. Often, using several threads a web page loads — each image is loaded in a separate thread. When the stop button is pressed by a user on the browser, all threads loading the page are canceled. A thread which is to ... Read More

What is default signal handler?

Arnab Chakraborty
Updated on 17-Oct-2019 09:00:01

938 Views

Signals are software interrupts which sent to a program to indicate that an important event has occurred. A Signal may be handled by following one of two possible handlers:A default signal handlerA user-defined signal handlerA Default signal handler is associated with every signal that the kernel runs when handling that signal. The action that a script or program performs when it receives a signal is called the default actions. A default signal handler handles these types of different default actions.Some of the possible default actions are −Terminate the process.Ignore the signal.Dump core. It creates a file called core containing the ... Read More

What is user-defined signal handler?

Arnab Chakraborty
Updated on 31-Jan-2020 11:05:12

807 Views

Signals are software interrupts which sent to a program to indicate that an important event has occurred. A Signal may be handled by following one of two possible handlers:A default signal handlerA user-defined signal handlerUser-defined signal handler can override this default action that is called to handle the signal. Signals are handled in different ways. Some signals (such as changing the size of a window) are simply ignored; others (such as an illegal memory access) are handled by terminating the program.A signal handler function may have any name, but must have return type void and have one int parameter.Example − ... Read More

Signals and Signal Handling

Arnab Chakraborty
Updated on 17-Oct-2019 08:55:35

3K+ Views

Signals are software interrupts which sent to a program to indicate that an important event has occurred. This events can vary from user requests to illegal memory access errors. Some signals, such as the interrupt signal, indicate that a user has asked the program to do something that is not in the usual flow of control. Depending on the source of and the reason for the event being signaled, A Signal can be either synchronously or asynchronously. All signals, whether synchronous or asynchronous, follow the same pattern −The occurrence of a particular event generates a signal.Next, the signal is delivered ... Read More

POSIX Thread Libraries

Arnab Chakraborty
Updated on 17-Oct-2019 08:49:29

782 Views

Pthreads refers to the POSIX standard (IEEE 1003.1c) defining an API for thread creation and synchronization. This defines specification for thread behavior, not an implementation. The specification can be implemented by OS designers in any way they wish. So many systems implement the Pthreads specification; most are UNIX-type systems, including Linux, Mac OS X, and Solaris. Although Windows doesn’t support Pthreads natively, some third-party implementations for Windows are available. The C program shown in Figure 4.9 demonstrates the basic Pthreads API for constructing a multithreaded program that calculates the summation of a nonnegative integer in a separate thread. Separate threads ... Read More

Implicit Threading and Language-based threads

Arnab Chakraborty
Updated on 17-Oct-2019 08:46:49

3K+ Views

Implicit ThreadingOne way to address the difficulties and better support the design of multithreaded applications is to transfer the creation and management of threading from application developers to compilers and run-time libraries. This, termed implicit threading, is a popular trend today.Implicit threading is mainly the use of libraries or other language support to hide the management of threads. The most common implicit threading library is OpenMP, in context of C.OpenMP is a set of compiler directives as well as an API for programs written in C, C++, or FORTRAN that provides support for parallel programming in shared-memory environments. OpenMP identifies ... Read More

Windows thread API in the C program

Arnab Chakraborty
Updated on 16-Oct-2019 10:39:12

2K+ Views

Threads are created in the Windows API using the CreateThread() function, and—just as in Pthreads—a set of attributes like security information, the size of the stack, and a flag for the thread is passed to this function. In the below program, we use the default values for these attributes. (The default values do not initially set the thread to a suspended state and instead make it eligible to be run by the CPU scheduler.) Once the summation thread is created, the parent must wait for it to complete before outputting the value of Sum, as the value is set by ... Read More

Multithreaded using the Pthreads API

Arnab Chakraborty
Updated on 16-Oct-2019 08:36:40

1K+ Views

Pthreads refers to the POSIX standard (IEEE 1003.1c) defining an API for thread creation and synchronization, which is a specification for thread behavior, not an implementation. This specification may be implemented by Operating-system designers in any way they wish. The C program shown in below, demonstrates the basic Pthreads API for constructing a multithreaded program that calculates the summation of a nonnegative integer in a separate thread. Separate threads begin execution in a specified function, in a Pthreads program. In below program, this is the runner() function. When the program begins, a single thread of control begins in main(). main() ... Read More

Programming challenges in multicore systems

Arnab Chakraborty
Updated on 16-Oct-2019 08:29:58

1K+ Views

The trend towards multicore systems continues to place pressure on system designers and application programmers to create higher use of the multiple computing cores. Designers of operational systems should write programing algorithms that use multiple process cores to permit the parallel execution shown in below Figure −Figure: Parallel execution on a multicore systemFor application programmers, the challenge is to switch existing programs with its style new programs that are multithreaded. In general, 5 areas of challenges are there in programming for multicore systems −Identifying tasks − This involves examining applications to seek out areas that may be divided into separate, ... Read More

Actions taken by a kernel to context-switch between kernel-level threads.

Arnab Chakraborty
Updated on 16-Oct-2019 08:28:43

2K+ Views

Context Switching involves storing the context or state of a process or thread so that it can be reloaded when required and execution can be resumed from the same point as earlier. This is a feature of a multitasking operating system and allows a single CPU to be shared by multiple processes.Actions taken by a kernel to context-switch between kernel-level threads are-Context switching between kernel threads typically requires saving the value of the CPU registers from the thread being switched out and restoring the CPU registers of the new thread being scheduled.

Advertisements