Contents
- 1 Are threads dependent or independent?
- 2 Why is threading necessary?
- 3 Is std :: thread cross platform?
- 4 What is the difference between platform dependent and independent?
- 5 Are there threads in Java that are platform dependent?
- 6 What happens to a thread when it expires?
- 7 How does the thread scheduling work in Java?
Are threads dependent or independent?
Threads are not independent of one another like processes are, and as a result threads share with other threads their code section, data section, and OS resources (like open files and signals). But, like process, a thread has its own program counter (PC), register set, and stack space.
Why is threading necessary?
Threads minimize the context switching time. Use of threads provides concurrency within a process. Efficient communication. It is more economical to create and context switch threads.
Is C platform independent or dependent?
C language is a platform independent programming language. Platform dependent language means that the code or the application will run under only one operating system.
Is std :: thread cross platform?
Standard C++ 11’s threading is based on boost::thread, now it’s cross platform and no dependency needed. The code is simple, the thread function will run right after the std::thread is declared.
What is the difference between platform dependent and independent?
Platform dependent means software will functions only in one particular platform it won’t work in all platforms means not in all operating systems. Platform independent means that the application can run in a diverse operating system.
Why C and C++ is not platform independent?
In case of C or C++ (language that are not platform independent), the compiler generates an .exe file which is OS dependent. When we try to run this .exe file on another OS it does not run, since it is OS dependent and hence is not compatible with the other OS.
Are there threads in Java that are platform dependent?
If you write safe multi-thread code, code that depends only on what is promised in the Java Language Specification and the library APIs, the choice of platform can, of course, affect performance, but not whether it works functionally. Thanks for contributing an answer to Stack Overflow!
What happens to a thread when it expires?
When its quantum expires, the thread returns to the RUNNABLE state, and the operating system assigns another thread to the processor. The process that an operating system uses to determine which thread to dispatch is called thread scheduling and is dependent on thread priorities.
What does it mean to be platform independent in Java?
The meaning of platform-independent is that the java compiled code (byte code) can run on all operating systems. A program is written in a language that is a human-readable language.
How does the thread scheduling work in Java?
Thread scheduling is platform dependent — the behavior of a multi-threaded program could vary across different Java implementations. In most operating systems, each thread is given a small amount of processor time—called a quantum or timeslice—with which to perform its task. A task utilizing it’s quantum is said to be in RUNNING state.