Wednesday, 12 February 2014

How to mount Windows 7 folder into guest Ubuntu 12.04 directory




Well,Hope you doing well.

When you are working on VM Box and Window machine simultaneously then usually you do share some stuff between Window and Virtual Box like some project file or other files/directroy which are reside in your Window machine .
Sometime you upload files intoVMBox using some external software which is tedious task.

Here, do some easy step's that make your easier to switch/mount window file into VMBox or vice-verse.


Step 1.

Open VM Virtualbox and Click on setting, select "Shared Folder" from left panel and add share folder to which you want to share into VM Box.At last ok with done.

Here Share folder name is D:\Shared



Steps-2: (VM Box Ubuntu Side )


Open a terminal and run following command one by one

$ sudo apt-get install dkms

Need to reboot your VM Virtaul Box then
$ sudo /sbin/reboot   

$sudo apt-get install virtualbox-ose-guest-x11

 Create a shared folder under /usr/work/ directory.


$mkdir shared_work

$sudo mount -t vboxsf Shared ./shared_work



I hope this stuff will help you.
Thanks
--------

Installing Guest Additions for Linux

  1. Open VirtualBox, and start your UbuntuVB virtual machine. After logging into Ubuntu with your user account, open a terminal window, and type sudo apt-get install dkms, followed by Enter. Then follow the instructions on screen to install the DKMS package. Once installed, close the terminal window.
  2. Select Devices | Install Guest Additions from the VirtualBox menu:
  3. VirtualBox 3.1: Beginner's Guide
  4. VirtualBox will mount the Guest Additions ISO file on your virtual machine's CD/DVD-ROM drive, and theVBOXADDITIONS icon will appear on your desktop.
  5. Now open a terminal window, and type cd /media/cdrom followed by Enter to change to the CD-ROM directory containing the Guest Additions. Then type sudo sh ./VBoxLinuxAdditions-x86.run, and pressEnter to start installing the VirtualBox Guest Additions on your virtual machine. When finished, the setup program will ask you to restart your Ubuntu VM.
    If you're running a 64-bit Linux guest, replace VBoxLinuxAdditions-x86.run with VBoxLinuxAdditions-amd64.run.
  6. Close the terminal window, restart your virtual machine, and wait for Ubuntu to boot up. Once is has finished booting up, a VirtualBox - Information dialog will appear to tell you that your guest operating system now supports mouse pointer integration.
  7. Enable the Do not show this message again, and click on the OK button to continue. Now you'll be able to move your mouse freely between your virtual machine's area and your host machine's area! You'll also be able to resize your virtual machine's screen, and it will adjust automatically!

Wednesday, 5 February 2014

Thread Synchronization - Monitors


Monitors

A monitor is like a building that contains one special room that can be occupied by only one thread at a time. The room usually contains some data. From the time a thread enters this room to the time it leaves, it has exclusive access to any data in the room. Entering the monitor building is called "entering the monitor." Entering the special room inside the building is called "acquiring the monitor." Occupying the room is called "owning the monitor," and leaving the room is called "releasing the monitor." Leaving the entire building is called "exiting the monitor." 

A graphical depiction of the kind of monitor used by a Java virtual machine is shown in Figure 20-1. This figure shows the monitor as three rectangles. In the center, a large rectangle contains a single thread, the monitor's owner. On the left, a small rectangle contains the entry set. On the right, another small rectangle contains the wait set. Active threads are shown as dark gray circles. Suspended threads are shown as light gray circles.






Figure 20-1 also shows several numbered doors that threads must "pass through" to interact with the monitor. When a thread arrives at the start of a monitor region, it enters the monitor via the leftmost door, door number one, and finds itself in the rectangle that houses the entry set. If no thread currently owns the monitor and no other threads are waiting in the entry set, the thread passes immediately through the next door, door number two, and becomes the owner of the monitor. As the monitor owner, the thread continues executing the monitor region. If, on the other hand, there is another thread currently claiming ownership of the monitor, the newly arrived thread must wait in the entry set, possibly along with other threads already waiting there. The newly arrived thread is blocked and therefore doesn't execute any further into the monitor region.

Figure 20-1 shows three threads suspended in the entry set and four threads suspended in the wait set. These threads will remain where they are until the current owner of the monitor--the active thread--releases the monitor. The active thread can release the monitor in either of two ways: it can complete the monitor region it is executing or it can execute a wait command. If it completes the monitor region, it exits the monitor via the door at the bottom of the central rectangle, door number five. If it executes a wait command, it releases the monitor as it travels through door number three, the door to the wait set.

The Java virtual machine offers two kinds of notify commands: "notify" and "notify all." A notify command selects one thread arbitrarily from the wait set and marks it for eventual resurrection. A notify all command marks all threads currently in the wait set for eventual resurrection.

To a great extent, the manner in which a Java virtual machine implementation selects the next thread from the wait or entry sets is a decision of individual implementation designers. For example, implementation designers can decide how to select: o a thread from the wait set given a notify command o the order to resurrect threads from the wait set given a notify all command o the order to allow threads from the entry set to acquire the monitor o how to choose between threads suspended in the wait set versus the entry set after a notify command. You might think it would make sense to implement entry set and wait sets as first-in-first-out (FIFO) queues, so that the thread that waits the longest will be the first chosen to acquire the monitor. Alternatively, it might make sense to have ten FIFO queues, one for each priority a thread can have inside the Java virtual machine. The virtual machine could then choose the thread that has been waiting the longest in the highest priority queue that contains any waiting threads. Implementations may take approaches such as these, but you can't depend on it. Implementations are free to implement the entry and wait sets as last-in-first-out (LIFO) queues, to select lower priority threads before higher priority threads, or to do anything else that may not seem to make sense. In short, implementations are free to select threads in an arbitrary manner that defies analysis and yields surprising orderings.