Skip to main content

Application Of Threads

 

Application Of Threads

Application Of Threads

This section discuss various implementation of threads. Multithreading concepts are implemented by pthread (POSIX standard), solaris, linux, window 2000 and java.

1. POSIX THREAD(Pthreads)

·         Pthread refers to the POSIX standard(IEEE 1003.IC) that defines an API for thread creation and sychronisation.

·         Prior to the of POSIX THREADS, each hardware vendor implemented their own version of threads.

·         As each implemented from the other, writing portable multithreaded application was difficult. Thus POSIX standardize the API for thread management.

·         The current Pthread API is defined only for C programming language and it is implemented as function with a header file Pthread.h and thread library.

·         The naming convention for Pthreads is well defined and the prefix of all the object or function is PTHREAD.

      


        Solaries Threads

·         Solaries 2 is a version of UNIX, that implements Pthreads API in addition to supporting user-level threads with a library containing APIs for thread creation and management.

·         Solaries implement multilevel thread support designed to provide considerable flexibility. It make use of four separate thread related concepts:

1.       Process. This is normal UNIX process and includes the user’s address space, stack and PCB.

2.       User level thread. A user level thread is a user created unit of execution within a process.these are created by application programmer.

They provide support for parallel execution within a process.

3.       Lightweight processes. A LWP is a mapping between user level and kernel threads.

4.       Kernel threads. These threads are visible to OS. They are managed by OS


LINUX Threads

·         Threads in linux are handled in a different way as compared to other operating system due to the open source nature of linux.

·         An  important  difference between linux threads and other threads is that linux does not differentiate between a process and a thread . a task represents basics unit of work in linux.

·         To create a child process, linux provides two system calls : fork and clone.

·         Clone call creates a child process like the fork call, but main difference is that, fork creates a child process that has itys own process context similar to that parent process whereas the child process created by clone shares parts of it execution context with the calling process, such as memory space, the file descriptor table and the signal handler table

·         At user level, various libraries that implements Pthreads are available. For example, linuxthreads,NPTL(native POSIX thread library ).


       Windows 2000 threads

·       Window 2000 implements the win32 API.

·       A Window Application  runs as a separate process where each process contains one or more threads.

·       Every thread of a process has access to the virtual address space of a process

·       The various data structure used by threads are:

1.      ETHEREAD (executive thread block).it includes pointer to the process to which thread belongs and the address of the routine in which the thread starts control.

2.      KTHREAD (kernel threads block). It includes scheduling and synchronistion information for the threads. It also includes the kernel stack and a pointer to TEB.KTHREAD also lies in kernel space and only kernel has access to it.

3.      TEB (thread environment block). It is a user space data structure that is accessed when thread is running in user mode. TEB contains a user model stack and an array for thread specific data



Comments

Popular posts from this blog

Monolithic Architecture

  Monolithic Architecture Monolith means composed all in one piece. The  Monolithic  application describes a single-tiered  software  application in which different components combined into a single program from a single platform. Components can be: Authorization — responsible for authorizing a user Presentation — responsible for handling HTTP requests and responding with either HTML or JSON/XML (for web services APIs). Business logic — the application’s business logic. Database layer — data access objects responsible for accessing the database. Application integration — integration with other services (e.g. via messaging or REST API). Or integration with any other Data sources. Notification module — responsible for sending email notifications whenever needed. Example for Monolithic Approach Consider an example of Ecommerce application, that authorizes customer, takes an order, check products inventory, authorize payment and ships ordered products. This applicat...

Change the priority of a process

  Change the priority of a process You can tell the computer that certain processes should have a higher priority than others, and so should be given a bigger share of the available computing time. This can make them run faster, but only in certain cases. You can also give a process a  lower  priority if you think it is taking up too much processing power. Go to the  Processes  tab and click on the process you want to have a different priority. Right-click the process, and use the  Change Priority  menu to assign the process a higher or lower priority. There is typically little need to change process priorities manually. The computer will usually do a good job of managing them itself. (The system for managing the priority of processes is called  nice .) Does higher priority make a process run faster? The computer shares its processing time between all of the running processes. This is normally shared intelligently, so programs that are doing more ...

Defination of OS(operating system) and its concepts

    What do you mean by operating system?     Definition :  An operating system is a program that act as an interface between the user of a computer and the                                      Computer hardware. Operating system is a first program that gets loaded into the memory through a process called booting. Concepts of operating system : ·                       The purpose of operating system is to provide an environment in which a user can execute program in a convenient and efficient manner. ·                       Operating system is an integrated set of program that ma...

System structure operating architecture

  System structure operating  architecture An operating system is a construct that allows the user application programs to interact with the system hardware. Since the operating system is such a complex structure, it should be created with utmost care so it can be used and modified easily. An easy way to do this is to create the operating system in parts. Each of these parts should be well defined with clear inputs, outputs and functions. Simple Structure There are many operating systems that have a rather simple structure. These started as small systems and rapidly expanded much further than their scope. A common example of this is MS-DOS. It was designed simply for a niche amount for people. There was no indication that it would become so popular. An image to illustrate the structure of MS-DOS is as follows − It is better that operating systems have a modular structure, unlike MS-DOS. That would lead to greater control over the computer system and its various applications. T...

Multilevel Feedback queue scheduling (MFQ)

  Multilevel Feedback queue scheduling (MFQ) ·          Multilevel feedback queue scheduling is an enhancement of multi-levelqueue scheduling. In this scheme, processes can move between the different queue ·          The various processes are separates in different queue on the basis of their CPU Burst Char characteristics ·          If a process consumes a lot of CPU time , it is placed into a lower priority queue. Thus I/O bound and interactive process are placed in the higher priority queue and CPU bound pricesses are in lower priority ·          If a processes waits too long in a lower priority queue it is moved higher priority queue. Such an aging prevents starvation. ·          The top priority queue is given smallest CPU time Quantum ·      ...