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.


COMMENTS

Name

advance-java,2,advancejava,1,aktu entrance exam,1,aktu exam schedule,1,ASP,1,bare machine,1,base register and limit register,1,Basic Computer network questions,1,C Programming,15,C Plus Plus,1,C Programming,2,C Programming MCQ,2,C Programming Questions,2,C programming study material for gate exam,13,CBNST Program,1,Childcare,1,CJ,2,Cloud Computing,1,components of use case diagram,1,Computer architecture based questions for gate exam,11,Computer Network,3,Computer Network Study Material,4,Computer network study material for gate,2,Computer Networks,7,Computer Science Study Material for Gate,20,computer science study material for gate exam,37,content based image retrieval content based image retrieval system,1,contiguous memory allocation,2,Core Java,8,COre Java Interview Questions,1,core java interviews questions,1,cyber crime report,1,Cyber crime status,1,cybercrime and security,1,cybercrime examples,1,Data link Layer Questions,1,Data Mining,1,Data Structure Questions,1,Data Transmission Architecture,1,Data Transmission in wsn,1,DBMS,4,dbms question paper,1,DE,1,Different types of addressing modes,1,Digital Electronics,1,DS,1,dynamic linking,1,dynamic linking in memory management,1,Electroencephalogram,1,file concept in os,1,File Handling,1,file management in operating system,1,FOC,1,Fundamenatl of Computer,1,Gate 2017,5,Gate 2017 Admit card,1,Gate 2017 Exam Schedule,1,Gate 2017 Syllabus,1,gate 2018,1,gate cse study material,1,gate practice set,10,gate study material for computer science,19,Gate study material for computer science 2017,1,GatePreviousYear,1,General,3,HCL Aptitude Test,1,HR Interview Questions,1,HTML,1,Image Processing,1,Important Date of Gate 2017 Exam,1,Information Security Policy,1,internal and external fragmentation,1,JS,1,lagrange's interpolation formula,1,lagrange's interpolation formula examples,1,Looping in C,1,MComputing,1,memory fragmentation,1,memory management,1,Motivational,4,NCER,2,Numerical Techniques Lab,1,OOT,1,Operating System,8,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,17,Operating system tutorial,3,ORACLE,1,page swapping,1,paged memory allocation,1,paged memory allocation in operating system,1,paging technique of memory management .paging technique,1,paging technique of memory management program in c,1,Pointer in C,5,Process based question for gate,1,Quiz on non conventional energy resources,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,segmentation in memory management,1,segmentation in memory management in operating system,1,Servlet,1,session tracking,1,session tracking in java,1,session tracking in servlet,1,Software Engineering,7,Software Engineering baes study material for gate,1,software engineering interview questions,1,Software Quality Assurance,3,SPM,1,SQL,1,Structure in C,1,Study Material for gate Computer Science,11,swapping in memory management,1,swapping in operating system,1,TCS Code Vita,1,Technical Questions from DBMS,1,Threads concept in operating system,1,Tips to Learn Coding,1,Top 30 Core Java Interview Questions with Answer,2,top down approach,1,top down approach in programming,1,Types of operating system,1,UML,1,use case diagram explanation,1,website uses cookies,1,what is cookies website,1,What is process control block ?,1,Wireless Sensor Network,4,worst fit algorithm for memory allocation,1,XML,1,
ltr
item
Computer Science Junction: Threads in operating system
Threads in operating system
tutorial on threads in operating system, threads study material,
https://2.bp.blogspot.com/-OJZu9rx9Yfc/WwD255wju4I/AAAAAAAAAts/VkDCIfVYKVkwnr0rJSyGZafe_3x3gjNwwCLcBGAs/s1600/single-and-multithreaded-process.png
https://2.bp.blogspot.com/-OJZu9rx9Yfc/WwD255wju4I/AAAAAAAAAts/VkDCIfVYKVkwnr0rJSyGZafe_3x3gjNwwCLcBGAs/s72-c/single-and-multithreaded-process.png
Computer Science Junction
https://www.computersciencejunction.in/2018/05/threads-in-operating-system.html
https://www.computersciencejunction.in/
https://www.computersciencejunction.in/
https://www.computersciencejunction.in/2018/05/threads-in-operating-system.html
true
425357657003182083
UTF-8
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