Monday, June 2, 2014

Master Java Platform-Concurrency

Java Platform:
1. Java Platform is provided as a library. Predix Platform is provided as a service. Java is a platform. To develop java platform, we need to collect different requirements, and provide common utility, API, framework, and tools as part of the platform.
2. To learn to use different Java Platform API, we also need to explore the API and do a POC with it.
3. It is very important to understand the capability of Java Platform Standard Edition and Enterprise Edition.
4. To develop java platform, the key is to implement data structure and algorithms, and develop frameworks. It is not about using open source tools and frameworks to develop applications.
5. If the goal is to implement java API, we need to master the data structure and algorithms, understanding Java Platform.
6. Developers: Develop Java Platform

Concurrency:
1.  Processing time for a single core is shared among processes and threads through an OS feature called time slicing.
2.  It's becoming more and more common for computer systems to have multiple processors or processors with multiple execution cores.
3.  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.
4.  Multithreaded execution is an essential feature of the Java platform.
5.   There are two basic strategies for using Thread objects to create a concurrent application.
5.1. To directly control thread creation and management, simply instantiate Thread each time the application needs to initiate an asynchronous task.
5.1. To abstract thread management from the rest of your application, pass the application's tasks to an executor.
6. When a thread invokes d.wait, it must own the intrinsic lock for d — otherwise an error is thrown. Invoking wait inside a synchronized method is a simple way to acquire the intrinsic lock.
7. Multi-threading is involving two operation classes trying to accessing/modifying the same instance variable.
8. I shall learn the introduction sections of java.
9. For multithreading,
    9.1 define a shared object with lock, synchronized method.
    9.2 define a thread class, holding shared object, and start threading
    9.3 define a main method to execute the program.
10. The core java API comes with a lot of high level API, framework, interfaces, different implementations which help optimize the performance of java applications, either standalone or java ee, etc.
11. Many advanced API, such as Executors, ForkJoinPool are helping build high scalable multi-threading applications, instead of directly interacting with low level API.
12. Many interviewers are asking the API understanding and usage of java technologies.
14. API: Executor, Executors, Runnable, Thread, Future, Callable, ThreadPoolExecutor, ScheduledThreadPoolExecutor,etc.
15. Project example: MicroFlow Framework, which support Sequencial, Concurrent, and conditional executions.
16. Understand Concurrency and high level API.


Techniques:
1.  In run method, define a loop, and use thread sleep to periodically execute shared object's operation.
2.  if (Thread.interrupted()) {
    throw new InterruptedException();
}
3. 

No comments:

Post a Comment