After upgrading from 11.10 to 12.04 I find I am randomly logged out while I am working.
I have no idea why this is happening.
Can anyone suggest why this is happening and perhaps a method to fix this most unproductive of issues?
I had this same issue in Ubuntu 10.10. It was caused by X (the graphical window system) crashing. What graphics card are you using? A good first step is to check if there are proprietary drivers available for your graphics card. Click System Settings -> Additional Drivers.
The thing that finally got it working for me was to enable the X-Updates repo, which has newer drivers, etc.
I ran into the same issue, where Ubuntu 12.04 was logging me out some time after locking the host OS (Win7, I'm running 12.04 in a VMware VM).
Locking the host OS and coming back later, the Linux VM was back at a login prompt, not a locked workstation prompt.
Updated the drivers as per above, but also installed the current nvidia drivers (my graphics card).
$ sudo apt-get install nvidia-current
Locked the host OS at lunch and came back and the Linux VM was where I left it. Hope this is helpful for others.