answersLogoWhite

0


Best Answer

yes,

because if process is terminated then its related thread has no work. After completion of process the kernel generates a thread that will cancelled the thread in order to save the time and memory of CPU.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

Yes, the thread will also terminate if the process it is running in terminates. The thread is dependent upon the processes it is running. If the processes die the thread dies.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: If a process terminates will its thread also terminate?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

If a process terminates will its thread also terminates?

Yes, the thread will also terminate if the process it is running in terminates. The thread is dependent upon the processes it is running. If the processes die the thread dies.


If process stop its execution will thread also stop or it will continue to run?

Processes do not execute, it is the threads within a process that actually execute. All processes have at least one thread of execution, the main thread. If the main thread falls from scope, the process ends, taking all threads with it. This can lead to undefined behaviour if the threads are not terminated gracefully from within the main thread before it falls from scope.


What happens to child thread when you delete main thread during run-time?

In Java, if the main thread somehow exits then all other threads will stop executing. This generally does not happen, as the main thread will wait for all child threads to terminate before the main thread itself finishes. Interrupting this process is hard to do short of an un-handled exception or a call to System.exit. If the child thread is also a daemon thread, then the child thread will continue to execute. If the child thread is a normal thread then, the moment System.exit is called, the child thread also terminates If you call the join() method from the child thread, then the main thread will wait until the child is over before executing the System.exit


What are the methods to forcibly terminate a thread?

To end a thread within the thread's own code you can also simply return from the thread function or method. However if you want to terminate a thread from code which is running outside of the thread's own flow you must typically code a mechanism of your own to do this. A simple way to do this is to have the threaded code check a shared signal variable every so often, if the variable is signaled - then the threaded code exits and the thread dies. Terminating a process (in C with say exit(..) ) will typically force the closing of any associated threads.


What is the difference between a Parent Process and Foreground Process?

A parent process is a process that has spawned one or more child processes such that it takes "ownership" of those processes. A foreground process typically means a process that has a user-interface as opposed to a background process which typically does not. Most background processes are services while most foreground processes are applications. It's important to note that the term "process" has a specific meaning in a multi-processing environment. A process is a computer program that has one or more threads of execution. A thread is the machine-level representation of a task and a process may instantiate as many tasks as are required (hardware permitting). All tasks share the same memory space as the process itself, however each task has its own stack for local storage, as well as to enable the thread's function call-and-return mechanism in addition to thread-local exception handling. Every process must have at least one thread of execution typically referred to as the main thread because that is the thread that executes the program's global main function (the entry point of the application) and subsequently instantiates any additional threads required by the main thread. The additional threads are usually called worker threads and any thread can instantiate its own worker threads. Unlike parent/child processes, thread's cannot "own" other threads; the threads are owned by the process. However, it is possible for worker threads to be controlled by other threads in the same process, so in that sense the controlling thread can be said to be a parent thread. When the main function returns, the main thread terminates, however any active threads within the process will continue executing, thus keeping the process "alive". In many cases this would be undesirable particularly if those threads attempt to access shared memory that is released by the main thread. So although there is no notion of ownership amongst threads, any controlling thread that must terminate before its workers have completed their tasks should signal its workers to terminate and then wait for them to terminate before terminating itself. Threads of execution within a process execute concurrently. All this means is that the operating system's task scheduler gives each thread a time-slice of the CPU to do some work, before saving the thread's state and moving onto the next thread (which may belong to another process entirely). Task-switching is so rapid that it can appear as though all threads are executing simultaneously, however that is only physically possible when the CPU has 2 or more cores available. Only one thread may execute upon any single core at any given moment. Multiple threads are typically used to maintain responsiveness. In a GUI environment, a time-consuming task would take up the entire time-slice of a process so it won't be able to respond to any messages on the message queue unless the task specifically checks the queue periodically. However, by using a worker thread to carry out the task, the controlling thread can remain responsive to messages. The message queue can also be used by threads to signal other threads, thus a controlling thread can respond to periodic progress reports from its worker threads if required. In this sense it can be said that the worker threads are background tasks, while the controlling thread is the foreground task.


What is the Difference between a single threaded file server and a multi-threaded file server?

Single thread means that the processor will wait until one 'process' is complete before it opens a new thread or 'process'. Multi-thread can handle multiple threads simultaneously making it faster and more responsive.


What is cascading process termination?

Some systems, including VMS, do not allow a child to exist if its parent has terminated. In such systems, if a process terminates (either normally or abnormally), then all its children must also be terminated. This phenomenon, referred to as cascading termination.


Is it safe to get tattoed when pregnant?

I would not do it, and it is not recommended either. Sometimes, a nervous tattooee will faint during the process, and rarely, they will also seizure. If you are pregnant when this happens it could terminate the fetus.


How you would achieve multithreading in java?

Java provides built-in support for multithreaded programming. A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution.A multithreading is a specialized form of multitasking. Multitasking threads require less overhead than multitasking processes.We achieve multithreading in Java by following this steps...New: A new thread begins its life cycle in the new state. It remains in this state until the program starts the thread. It is also referred to as a born thread.Runnable: After a newly born thread is started, the thread becomes runnable. A thread in this state is considered to be executing its task.Waiting: Sometimes a thread transitions to the waiting state while the thread waits for another thread to perform a task. A thread transitions back to the runnable state only when another thread signals the waiting thread to continue executing.Timed waiting: A runnable thread can enter the timed waiting state for a specified interval of time. A thread in this state transitions back to the runnable state when that time interval expires or when the event it is waiting for occurs.Terminated: A runnable thread enters the terminated state when it completes its task or otherwise terminates.


What is a decimal number called when it ends or terminates?

A terminating number. It can also be called a rational number.


Is 6.708204 an irrational number?

No. 6.708204 = 6708204/1000000 = 1677051/250000 Any decimal that terminates (does not go on for ever) is a rational number. Any decimal that does not terminate, but recurs (ends in repeating digit(s)) is also a rational number, eg 0.66... = 2/3, 0.142857142857... (repeating the same 6 digits 142857) = 1/7


What is cascading terminator?

Some systems, including VMS, do not allow a child to exist if its parent has terminated. In such systems, if a process terminates (either normally or abnormally), then all its children must also be terminated. This phenomenon, referred to as cascading termination.