We use threads due to many reasons A thread plays a key role in the designing

We use threads due to many reasons a thread plays a

This preview shows page 3 - 5 out of 6 pages.

We use threads due to many reasons. A thread plays a key role in the designing of an operating system. A process with multiple threads makes a great server for example printer server. Because threads can share common data, they do not need to use inter process communication .Because of the very nature, threads can take advantage of multiprocessors. Threads are cheap as they only need a stack and storage for registers therefore, threads are cheap to create. Threads use very little resources of an operating system in which they are working. That is, threads do not need new address space, global data, program code or operating system resources. Context switching are fast when working with threads. The reason is that we only have to save and/or restore PC, SP and registers. Fig. 1 Single-threaded processes and Multithread processes III. SINGLE-THREADED PROCESS Single threaded processes contain the execution of instructions in a single sequence. In other words, one command is processes at a time. The opposite of single threaded processes are multithreaded processes. These processes allow the execution of multiple parts of a program at the same time. These are lightweight processes available within the process. 1V. MULTI -THREAD PROCESS Multithreading is mainly found in multitasking operating systems. Multithreading is a widespread programming and execution model that allows multiple threads to exist within the context of a single process. These threads share the process's resources, but are able to execute independently. The threaded programming model provides developers with a useful abstraction of concurrent execution. Multithreading can also be applied to a single process to enable parallel execution on a multiprocessing system. There are two types of threads to be managed in a modern system: User threads and kernel threads. User threads are supported above the kernel, without kernel support. These are the threads that application programmers would put into their programs. In a specific implementation, the user threads must be mapped to kernel threads, using one of the following strategies.
Image of page 3
A. Many to one: Where many user level threads are mapped to as single kernel thread. In such model the thread is managed by thread library in the user space which makes such model efficient. However the entire threads can be blocked if a thread makes a blocking system call. Also; with multiprocessors system; threads can access the kernel with only a single thread at a time and as such; multiple threads are unable to take advantage on multiprocessor and run in parallel on multiprocessors. With such model, developer will be able to create as many threads as required; however the true concurrency is not implemented since the
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 6 pages?

  • Fall '16
  • Sir Adnan
  • Central processing unit, Computer program, Computer multitasking

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors