Home Games Java Concurence Support And Modifiers

Java Concurence Support And Modifiers

0

The Java platform is designed from the ground to support concurrent programming, with basic concurrence support in the Java programming language and the Java class libraries. In concurrent programming, there are two basic units of execution: processes and threads. In the Java programming language, concurrent programming is mostly concerned with threads. However, processes are also important.

Processes

A process has a self-contained execution environment. A process generally has a complete, private set of basic run-time resources; in particular, each process has its own memory space. Processes are often seen as synonymous with programs or applications. However, what the user sees as a single application may in fact be a set of cooperating processes. To facilitate communication between processes, most operating systems support Inter Process Communication (IPC) resources, such as pipes and sockets. IPC is used not just for communication between processes on the same system, but processes on different systems.

Threads

Threads are sometimes called lightweight processes. Both processes and threads provide an execution environment, but creating a new thread requires fewer resources than creating a new process. Threads exist within a process – every process has at least one. Threads share the process’ resources, including memory and open files. This makes for efficient, but potentially problematic, communication.

Access modifiers available in Java.

Access modifier specify where a method or attribute can be used. Public is accessible from anywhere. Protected is accessible from the same class and its subclasses. Package/Default are accessible from the same package. Private is only accessible from within the class.

Abstract class and an interface

An abstract class can have concrete method, which is not allowed in an interface. Abstract class can have private or protected methods and variables and only public methods and variables are allowed in interface. We can implement more than one interface, but we can extend only one abstract class. Interfaces provides loose coupling whereas abstract class provides tight coupling.

garbage collection

Garbage collection is the process of releasing memory used by unreferenced objects. It relieves the programmer from the process of manually releasing the memory used by objects.

Limitation: It adds an overhead that can affect performance. Additionally there is no guarantee that the object will be garbage collected.

JAR files in Java is and their importance.

JAR stands for Java Archive. This is a file format that enables you to bundle multiple files into a single archive file. A jar file will contains a manifest.mf file inside META-INF folder that describes the version and other features of jar file.

Share this post if you found it useful or leave your feedback in the comments section below.

LEAVE A REPLY

Please enter your comment!
Please enter your name here