Download presentation
Presentation is loading. Please wait.
Published byOswin Conley Modified over 6 years ago
1
Threading Issues A user presses a button on a web browser that stops a web page from loading any further: The thread accepting the user stop button press Wants the thread loading the page to be cancelled.
2
Signals, Messages Signals are used in UNIX systems to notify a process that a particular event has occurred A signal handler is used to process signals Signal is generated by particular event Signal is delivered to a process Signal is handled Every signal may be handled by one of two possible handlers: 1. A default signal handler 2. A user-defined signal handler
3
Signals generation, handling
Unix Sending signals - kill(pid, SIGNAL) – send signal to other process (pid) Handling signals - signal(SIGNAL, handling_function); Windows WinAPI Sending signals – InvalidateRect(x,y,x1,y1) – send signal to repaint the part of window. Handling signals – case WM_PAINT {. . .}; or WM_... messages.
4
PThreads
5
Pthreads example
6
WinAPI Threads
7
Semantics of fork() and exec()
Does fork() duplicate only the calling thread or all threads in multithreaded environment ? (Unix) There are two types of fork in different unix type systems: fork() – that duplicates the whole context fork() – that duplicates only a thread called the fork() exec() – works as before replacing the whole space by the new program. If exec is called immediately after forking, then duplicating all threads is unnecessary.
8
Threads Linux Threads
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.