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

Message Delivery Protocol

  Message Delivery Protocol ·          A protocol is a set of rules and conventions shared by communicating entities . ·          Message passing can be blocking or non blocking . ·          In blocking protocol , a sender process is blocked till the message selivered to the . in this case , sender process has guarantee that the message sent by it ie delivered before it continues its execution . A blocking protocol normally includes: 1.        Blocking send : the sender process is blocked until the message is received by the receiving process or by the mailbox. 2.        Blocking receive : the receiver nlocks until a message is available thus when both sender as well as receiver is blocked ,it is known as rebdevezevous . this combination allows for tight sysnchronization between process. ·...

Multitasking System

  Multitasking system ·           Technically , multitasking is same as multi programming ·           In a multitasking operating system, s single user can execute multiple programs at the same time ·           We can also say, multitasking is the system capability to work on more than one job or process at the same time. ·           It means that whenever a job needs to perform I/O operation, the cpu can be used for execting some other job                                                        diagram of multi tasking     ·           There are two type of multitasking : 1.       ...

Service provided By An Operating System.

  List of five service provided by an operating system. Explain how  each provides convenience to users?     The main purpose of operating system is to provide environment for the execution of programs. Thus an operating system provides certain services to program and the users of those programs. However , different operating system can provide different set of service. Some of the basis services provided by operating system are: 1.         Program execution ·          Operating system provides a convenient environment where users can run their programs ·          The operating system performs memory allocation to programs, load them into appropriate location so that they can execute. The users need not to worry about all these tasks.   2.         I/O Operation ·        ...

Multi user Operating System

  Multi user operating system ·           In a multi-user operating system, multiple number of user can access different resources of a computer at a same time. ·           The access is provided using a network that consists of various personal computer attached to a mainframe computer system.                                                              diagram of multi -user operating system       ·           The various personal computer can send and receive information to mainframe computer system. ·           The example    of multi-user OS are UNIX, windows 2000,novell netware.            sing...

Easytolearn E-book 2

                                                                                                                                                                          Description:here we give you pdf. about classification of operating system in which  we provide all information of classification in detail.