When we create a thread object, the thread is born and is said to be in a new born state. At this state we can do one of the following things- a) Schedule it for running using start() method which in turn call the run() method. Then the thread goes to the ready state or runnable state. b) Kill it using the stop() method.
The runnable state means that the thread is ready for execution and waiting for the availability of processor. If all the Threads are of equal priority, then they are given time slots for execution in Round Robin Fashion that is FCFS manner.
This process of assigning time to Threads is known as time slicing. All the threads in this state form a queue.
Running means that the processor has given its time to the thread for its execution. Then the run() method is executed.
A thread enters into the blocked state when one of the following event occurs-
1) The thread itself or another thread calls the suspend() method. A suspended thread can be revived by using the resume() method.
2) The thread itself calls the sleep(long milisec) method. After sleeping it comes to ready state.
3) The thread calls an objects wait() method to goto waiting state . If any other thread calls the notify() method then it returns to runnable / ready state.
4) If the thread is waiting for an I/O to be completed, after I/O completion it returns to the ready state.
A blocked thread is considered as “NOT RUNNABLE” but not dead & therefore fully qualified to run again.
If a running thread ends its life when it has completed execution of its run() method . It is a natural death. However we can kill this thread forcefully, by sending the stop() method to it. A thread can be killed
as soon as it is born, or
while it is running , or
even when it is in blocked state.
yield( ) : voluntarily moves the current running thread to the queued ready state.
In the following PHP program I have accessed the MySQL database (using PHP’s object oriented mysqli extension ) by a PHP function generated by me, and fetched a “MySQL database table” column value (Departments column) based on some key value in another column ( Serial ). To get the required value from database you have to just call a function like this : function getDepartmentName( $dbTableName, “Serial”, 2, “Departments”) where Serial and Departments are two columns of same database table, and 2 is the value in the Serial column in a record. If you dont know PHP MySQL – visit our PHP MySQL programming online coaching classes
Say if you pass the Serial = 2, you will get the corresponding column value of Departments column = ARCHITECTURE, which is located in the same record in the database table, but in different columns. Don’t worry whole table structure shown below.
If you want to install JDK / JRE in Ubuntu 14.04 LTS version then just download the archive file jdk1.8.0_66.tar.gz. The file name will be of this type jdk1.8.0_66.tar.gz , after downloading you have to put it in /opt/ directory. Use the following steps to install java 8 manually in Ubuntu 14.04 LTS version from jdk1.8.0_66.tar.gz archive files. Continue reading “Install Java jdk8 in Ubuntu 14.04 from .tar.gz archive files”