Saturday, June 8, 2013

Java - Thread

Java offers thread manipulation that allows even single core computer do multitasking, which is also known as Multiprogramming, a way of parallelism.

A Java thread will always be in one of four different states:

  • New
  • Runnable
  • Blocked
  • Dead
"When designing a program that uses multiple threads, we must be careful not to allow an individual thread to monopolize the CPU."  (Textbook)
The above mentioned could potentially lead to hanging of an application, which appears to be running but in fact, doing no computation at all. However, some OS can solve this problem by bring Round Robin as the mechanism to avoid such monopolization. 

A linked list is a collection of nodes that form a linear ordering together. 
A singly linked list:
The next reference inside a node can be viewed as a link/pointer to another node.
Moving from one node to another by following a next reference is known as link hopping/pointer hopping.
The first and last node of a linked list are called the head and tail of the list.
The tail contains a null reference, that indicates the ends of the list.

A singly linked list does not have a predetermined fixed size, and uses space proportional to the number of its elements.