a. Register values
b. Heap memory
c. Global variables
d. Stack memory
A multithreaded program is one that has multiple threads in execution. They may execute parallel to one another or totally without relation to one another. In Java you can create multithreaded programs using Java threads.
- USER LEVEL THREADS Aadvantages: · User-level threads can be implemented on operating system that does not support threads. · Implementing user-level threads does not require modification of operating system where everything is managed by the thread library · Simple representation which the thread is represented by a the thread ID, program counter, register, stack , all stored in user process address space · Simple management where creating new threads, switching threads and synchronization between threads can be done without intervention of the kernel · Fast and efficient where switching thread is much more inexpensive compared to a system call - Disadvantages: · There is a lack of coordination between threads and operating system kernel. A process gets one time slice no matter it has 1 thread or 10000 threads within it. It is up to the thread itself to give up the control to other threads · If one thread made a blocking system call, the entire process can be blocked in the kernel, even if other threads in the same process are in the ready state KERNEL LEVEL THREAD: - Advantages: · Because kernel has the full knowledge of all the threads, scheduler may decide to allocate more time to a process having large number of threads than process having small number of thread, where the kernel threads come useful for intense application - Disadvantages: · Kernel level threads are slow and inefficient, since kernel must manage and schedule all the threads as well as the processes. It requires a full TCB for each thread to maintain information about threads, which results in increasing of overheads and kernel complexity
The resources that are shared by all threads of a process in Operating SystemsareMain memoryInput Output DevicesInput Output ChannelsFiles
Load Sharing: Processes are not assigned to a particular processor. A global queue of threads is maintained. Each processor, when idle, selects a thread from this queue.Gang Scheduling: A set of related threads is scheduled to run on a set of processors at the same time, on a 1-to-1 basis. Closely related threads / processes may be scheduled this way to reduce synchronization blocking, and minimize process switching. Group scheduling predated this strategy.Dedicated processor assignment: Provides implicit scheduling defined by assignment of threads to processors. For the duration of program execution, each program is allocated a set of processors equal in number to the number of threads in the program. Processors are chosen from the available pool.Dynamic scheduling: The number of thread in a program can be altered during the course of execution.
threads are the light weight process or it is a part of the process which can execute simulteniously by sharing systm resources.... two types of thread 1.user level thread 2.kernel level thread
Obviously Heap Memory
A multithreaded program is one that has multiple threads in execution. They may execute parallel to one another or totally without relation to one another. In Java you can create multithreaded programs using Java threads.
Yes but there is not enough time or enough space here for a full justification of the answer
A Program in Java that spawns multiple threads is called a multithreaded program in Java.
Java is called multithreaded because it allows the programmer to define multiple threads of execution manually. The main program would continue to execute as one thread and we can speed up the processing by declaring individual threads. Threads in Java can be created in two ways: 1. By extending the Thread class & 2. By implementing the Runnable interface
There r some resources shared by different threads o the same process while some r not. The threads shares the address space,file,global variables. But each threads has its own stack , copy of registers(including PC).
A write-up of the answer to this question can be found here:http://msdn.microsoft.com/en-us/library/ms693344(VS.85).aspx"There are two types of apartments: single-threaded apartments, and multithreaded apartments. * Single-threaded Apartments-Single-threaded apartments consist of exactly one thread, so all COM objects that live in a single-threaded apartment can receive method calls only from the one thread that belongs to that apartment. All method calls to a COM object in a single-threaded apartment are synchronized with the windows message queue for the single-threaded apartment's thread. A process with a single thread of execution is simply a special case of this model.* Multithreaded Apartments-Multithreaded apartments consist of one or more threads, so all COM objects that live in an multithreaded apartment can receive method calls directly from any of the threads that belong to the multithreaded apartment. Threads in a multithreaded apartment use a model called free-threading. Calls to COM objects in a multithreaded apartment are synchronized by the objects themselves."
A program is an executable. A process is an executable that has been loaded into working memory and is currently executing the program. A thread is a thread of execution within a process. Every process has at least one thread, but threads can spawn additional threads as required to allow concurrent operations to be performed near-simultaneously.
number of process in system number of threads in a program..
A process is a program in execution,it needs resources like CPU time,memory,files and i\o devices to accomplish its task. Threads are lightweight process
You use threads whenever you want your program to do several things simultaneously.You use threads whenever you want your program to do several things simultaneously.You use threads whenever you want your program to do several things simultaneously.You use threads whenever you want your program to do several things simultaneously.
to ensure that two concurrently-executing threads or processes do not execute the same code of a program at the same time. to control access to state both in small-scale multiprocessing systems -- in multithreaded environments and multiprocessor computers - and in distributed computers consisting of thousands of units - in banking and database systems, in web servers, and so on.