Managing and Implementing Multithreading

What happens when a long-running program starts executing on a client's computer? How do operating systems handle such long-running processes? Does the operating system notify the user about their progress? How does the operating system let the user know when it has finished with these processes? Threading is the way in which the operating system handles the responsiveness of your program while managing other system resources. This is achieved using multiple threads of execution, which is one of the most powerful ways to keep your application responsive while using the processor for other events.

An operating system organizes each running application as a process. Each process may contain one or more threads. A thread allows the operating system to allocate processor time as required. Each thread holds scheduling priority and a set of structures that are used by the system to pause or execute the thread. This is called thread context. In other words, the thread context holds all the information that's required by the system to seamlessly resume execution. As we've already mentioned, a process can contain multiple threads, all of which share the same virtual address space of the process.

In this chapter, we will focus on creating and managing threads, synchronizing data across threads, and multithreading. We'll also look at how the operating system uses this concept to keep the responsiveness of the application.

In this chapter, we will cover the following topics:

  • Understanding threads and the threading process
  • Synchronizing data in multithreading
  • Multithreading
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.249.174