Flashcards
Lecture 5 - Multi-threading and more about Java RMI

Cards in this deck (5)
- 1Multi-threading: - A multi-threaded program contains 2 or more parts that can run concurrently and each of those parts can handle different task at the same time

- 2—


- 3Thread operations: - Each Java thread has a priority that helps the operating system determine the order in which threads are schedules - Java threads priorities are in the range between MIN_PRIORITY (a constant of 1) and MAX_PRIORITY (a constant of 10) public final void int setPriority(int Priority)public final void setDaemon(boolean on)
- A daemon thread is a thread that does not prevent the JVM from exiting when the program finishes, but thread is still running.
An example of daemon thread is garbage collection. A parameter of true denotes as a daemon thread
join(long millisec)
- The current thread invokes this method on a second thread, causing the current thread to block until the second thread terminates - 4public void interrupt() - interrupt this thread, causing it to continue execution if it was blocked for any reason public final boolean isAlive() - returns true if the thread is alive, which is any time after the thread has been started by before it run to completion public static void yield() - Causes the currently running thread to yield to any other threads of the same priority that are waiting to be schedules

- 5Multi-threading in RMI: - RMI by default is multi-threaded (eg: multiple clients can connect to the same servers) - The RMI server-side infrastructure creates threads and invokes remote objects in those threads - Remote method invocation on the same remote object may execute concurrently On client side - RMI adds no threading complication - A request is marshalled and sent through a socket - The thread sending the request then tries to read a response back from the server, over the socket - the calling thread (on the client) blocks until the server sends a responsedone
Information
- Description
- Distributed systems Flashcards on Lecture 5 - Multi-threading and more about Java RMI, created by minal Kotwal on 25/10/2016.
- Created by
- minal Kotwal
- Views
- 0
- Rating