Threads in operating system

tutorial on threads in operating system, threads study material,

Thread's Concepts in Operating System 

Today in this Operating System Study Material and Tutorial   I will discuss about threading concepts such as threads basic , its advantages, threads implementation in operating system , user level and kernel level threads.

Lets see each one by one -

what is thread in os ?

A thread is nothing but a light  weight process which can utilize the cpu independently.  A thread meaning is just  a flow of execution through its  process code.

Like a process a thread also its  thread control block. Which keeps the information about that thread.  Thread control block also has program counter field  that keeps track of which instruction to execute next. It also has system registers which tell about the information about  its current working variables, and a stack which contains the execution history.

The most important point to be noted about the thread is that a thread shares with its peer threads various information like code segment, data segment, and open files. If one thread tries to alters a code segment memory item, then all other threads can see that.

Threads provide a method to  improve application performance This method is nothing but the use of parallelism. Thread use parallelism or multi-threading concepts to improve performance of the application.  Threads gives a software based approach to reduce the overhead.

More than one threads belongs to exactly one process, and no thread can exist outside a process. Each thread represents a separate flow of control.

In the present time threading concepts is also successfully used  in implementing network servers and web servers. They also provide a best support for parallel execution of applications using shared memory multiprocessors.

Advantages of Threads 

There are following advantages of threads in operating system 

  •          They minimize the context switching time. Context switch overhead is less as compare to switching overhead among the processes.
  •          We can achieve concurrency or parallelism by using more than one threads in a single process.
  •          They provide efficient communication.
  •          It is more economical to create and context switch threads.
  •      It is easy to utilize the multiprocessor architectures using threads to a greater scale and efficiency.

Difference between user level thread and kernel level thread

Implementation of threads in operating system is handled in two manner which are as follows-

        (1)   User Level Threads
       (2)   Kernel Level Threads

        User Level Thread
      User level threads manage user threads it means thread related to user process. In this case, the thread management kernel does not have information about presence of threads. The thread library is used to manage the user level thread this thread library include the code for the following purpose.

  •          To create and destroy the threads.
  •           To  pass messages and data among threads.
  •           To  schedule   an execution of thread.
  •          To  save and restore the thread contexts.

   Advantages of User Level Threads

  •      In user levels threads , Thread switching does not require any  Kernel mode  privileges.
  •      User level threads are independent from operating system they can run on any os.
  •       With  the user level threads it is easy to make scheduling more application specific.
  • ·              It is easy to create and manage fast user level thread.

         Disadvantages of User Level Threads

  •          Most of the system calls are blocking call.

  •        Multi threaded application cannot take advantage of multiprocessing.
Operating System tutorial on thread

         Kernel Level Threads

     These are the threads managed by operating system which are acting on a kernel, an operating system core. In case of kernel level threads  , thread management is done by the Kernel. Thread management code in the application area  is not available here because  Operating System directly supports to Kernel levels  threads.

     Here any application can be programmed to be multi threaded. All of the threads  are supported within a single process for an application. These threads share the same code , data and file of the process to which they belong.
      It is the responsibility of the kernel to  maintains context information for the process as a whole and for individuals threads within the process. Scheduling by the Kernel is done on a thread basis. The Kernel performs thread creation, scheduling, and management in Kernel space. Kernel threads are generally slower to create and manage than the user threads.

    Advantages of Kernel Level threads: 

       There are following advantages of Kernel level threads
  •     The Kernel can simultaneously schedule multiple threads from the same process on multiple processes.
  •      One major advantage of kernel level thread is that If any one thread in a process is blocked, then  Kernel is capable of scheduling a new thread for that process.
  •        Kernel routines themselves can be multi threaded.

Disadvantages of Kernel Level threads:

  •     Kernel threads are created and managed slowly as compare to user level threads.  

I hope this Operating System Study Material which is based on threads concepts will be beneficial for computer science students.



addressing modes types,1,advance-java,2,aktu entrance exam,1,aktu exam schedule,1,ASP,1,bare machine,1,base register and limit register,1,C Programming,12,C Plus Plus,1,C Programming,5,C Programming Questions,1,C programming study material for gate exam,7,Cache Memory,1,CBNST Program,1,Childcare,1,CJ,1,Cloud Computing,1,CN,3,Computer Architecture,2,Computer architecture based questions for gate exam,11,Computer Network,8,Computer Network Study Material,2,Computer network study material for gate,1,Computer Networks,8,Computer networks GATE Questions,2,Computer Science Study Material for Gate,14,computer science study material for gate exam,28,conditional statements in c,1,contiguous memory allocation,2,Core Java,3,cyber crime report,1,Cyber crime status,1,cybercrime and security,1,cybercrime examples,1,Data Structure,2,Data Structure Questions,1,Data Transmission Architecture,1,Data Transmission in wsn,1,database normalization,1,DBMS,6,dbms question paper,1,DE,1,Digital Electronics,1,DS,4,Dynamic memory allocation in c,1,Electroencephalogram,1,file management in operating system notes,1,Gate 2017,3,Gate 2017 Admit card,1,gate cse study material,1,gate practice set,7,gate study material for computer science,12,Gate study material for computer science 2017,1,General,3,HCL Aptitude Test,1,HR Interview Questions,1,HTML,4,Important Date of Gate 2017 Exam,1,Information Security Policy,1,internal and external fragmentation,1,JDBC,2,JS,1,lagrange's interpolation formula,1,lagrange's interpolation formula examples,1,memory fragmentation,1,memory management,1,memory management questions and answer in os,1,Motivational,4,NCER,1,Numerical Techniques Lab,1,OOT,1,Operating System,10,Operating System Gate Questions,1,Operating System Objective Questions,4,Operating System Questions Bank,1,Operating system questions for gate,1,Operating System Study material,2,operating system study material for gate exam,13,Operating system tutorial,2,page swapping,1,paged memory allocation,1,paged memory allocation in operating system,1,Pointer in C,4,Process based question for gate,1,Regression testing,1,relocation in memory management,1,relocation registe,1,relocation register,1,resident monitor,1,resident monitor in operating system,1,routing table,1,Software Engineering,10,Software Engineering baes study material for gate,1,Software Quality Assurance,3,software verification methods,1,Stack,1,Structure in C,1,Study Material for gate Computer Science,7,swapping in memory management,1,swapping in operating system,1,TCS Code Vita,1,TCS Interview Questions,1,Technical Interview,1,Technical Questions from DBMS,1,Thrashing in Operating System,1,Threads concept in operating system,1,Tips to Learn Coding,1,Types of operating system,1,UML,1,Virtualization,1,What is process control block ?,1,what is software testing?,1,Wireless Sensor Network,3,worst fit algorithm for memory allocation,1,XML,2,
Computer Science Junction: Threads in operating system
Threads in operating system
tutorial on threads in operating system, threads study material,
Computer Science Junction
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share. STEP 2: Click the link you shared to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy