Month: February 2016


This is the final article in this series of “Effective Java – Key Points”. Let’s jump into the points.

  1. Synchronization is required for reliable communication between threads as well as for mutual exclusion. Synchronization will not have effect unless both read and write are synchronized.
  2. If only inter-thread communication is required and not mutual exclusion, then volatile modifier can be used.
  3. Avoid excessive synchronization. Never call an alien method from a synchronized region, to avoid any deadlock or data corruption as an alien method are designed to be subclassed and the API will never know what the implementation of those methods is.
  4. Never use newCachedThreadPool in a highly loaded environment because it as good as creating as many threads as requested. It is ideal to use newFixedThreadPool which could be optimized based on the server capacity.
  5. Lazy initialization holder class idiom and Double check idiom should be used in case of lazy initialization of threaded environment.


UNIX Basic Commands

As a programmer, every one of us gets to work on various platforms like Windows, Unix, Linux, etc. It is highly essential we know some basic commands for platforms other than Windows which is a strong visually aided platform. Here is a list of few commands which I have used and I feel will be useful on a daily basis.

Command Description
more Fit the content in a screen
mv Move the file
vptime Find how many days the server was up
cp Copy the file
rm Remove the file
wc Word count
chmod Change mode (permissions of the file/folder)
gzip Compress a file
gunzip Uncompress a file
mkdir Create a directory
cd Change directory
pwd Present working directory
who Tells who’s logged in
passwd Allows the user to change the password
kill <process id> Kill a process
dos2unix Convert dos format to UNIX format
du <filename> Find the disk usage of a file
last <username> List the last few logins
uname -a Find which OS is running on UNIX
top Find which process is utilizing how much CPU
rlogin  Connect to the remote host
telnet Connect to the remote host
ftp  Connect and download files from a remote machine
date Displays current date
cal Displays current month calendar
nohup Run the job in the background
cat <filename> Dump a file on the screen
vi Edit a file
head <filename> Display first few lines from the file
tail <filename> Display last few lines from the file
grep Search command
find  Find files on the system
cd – Switching to old PWD directory
ls List the files
jps List the current running processes
ps List the process
split Split the huge files into small files based on the line count