Threading in Java and C# A Focused Language Comparison Overview
Short Description
Both Java and .NET have built-in support for threads. In Java, this support is in three main forms: a mutex variable is associated with every object; there is a set of methods defined on Object that support coordination of threads; and a set of classes in java.lang that allows programmers to create and manage threads. Similarly, in .NET there is a Monitor (or lock) associated with every object instance. The System.Threading namespace contains classes that allow thread creation and manipulation.
Website: www.shannonhardt.com | Filesize: 84kb
No of Page(s): 11
Content
…
While the APIs available to programmers are constant, the underlying implmentation of threads at the operating system level is not specified in the run time specifications and may be different depending on the run time implmentation of Java or .NET that is being used. In the standard implementations on Windows, user threads created in Java or .NET correspond 1 to 1 to user threads at the operating system level. The following diagram illustrates the relationship between user threads, operating system threads, and processes in Windows.
…
When threads are created in the default manner, they are created as foreground threads in both Java and .NET. Foreground threads will keep the execution environment alive even if the main thread of control is finished. It is also possible to create background (or daemon) threads in Java and .NET. Background threads will not keep the managed execution environment alive if all other foreground threads have terminated. In Java, a thread is marked as background using the Thread.setDaemon(boolean) method, while in .NET, there is a boolean property that can be set: Thread.IsBackground.
…
Get the file Download here
Related Books:Related Searches: support coordination, execution environment, language comparison, boolean property, thread creation
Comments
Leave a Reply