Tuesday, January 24, 2012

MS-DOS 6.22 & 640k memory limits

I had one hell of a time getting MS-DOS to work properly. 640k right? After lots of reading I finally got DOS to load a TCP/IP Stack, SB16 Drivers, CD-ROM drivers and Win3.11 all working nicely and loading properly without memory errors.

I used the following AUTOEXEC.BAT and CONFIG.SYS to get everything to load. (Something my hours of googling never found). Final memory output (VM has 32mb of memory)


Memory Type        Total  =   Used  +   Free
----------------  -------   -------   -------
Conventional         638K      246K      392K
Upper                  0K        0K        0K
Reserved               0K        0K        0K
Extended (XMS)    30,656K    2,396K   28,260K
----------------  -------   -------   -------
Total memory      31,294K    2,642K   28,652K

Total under 1 MB     638K      246K      392K

Largest executable program size       392K (401,392 bytes)  
Largest free upper memory block         0K       (0 bytes)  
MS-DOS is resident in the high memory area.


Not too bad, 61% memory free, I'm sure there is more I can do to extend the memory usage, but I got my ancient copy of Stonekeep and the D&D Gold box CD series to work, good enough for me.

AUTOEXEC.BAT

@ECHO OFF


REM --- Sound
SET SOUND=C:\SB16
SET BLASTER=A220 I5 D1 H5 P330 T6
SET MIDI=SYNTH:1 MAP:E
LH C:\SB16\DIAGNOSE /S
LH C:\SB16\MIXERSET /P /Q




REM ---  By HiSpeed CD-ROM Drive installation program.  1/23/2012  ---
LH C:\DOS\SMARTDRV.EXE /X
LH C:\DOS\MSCDEX.EXE /D:MSCD000


SET TEMP=C:\TEMP


REM --- Load utilities & Set settings ---
LH c:\util\dosidle.exe
PROMPT $p$g
PATH C:\NET;C:\DOS;c:\WINDOWS


REM --- Networking ---
C:\NET\net initialize
LH C:\NET\nwlink
LH C:\NET\netbind.com
LH C:\NET\umb.com
LH C:\NET\tcptsr.exe
LH C:\NET\tinyrfc.exe
LH C:\NET\nmtsr.exe
LH C:\NET\emsbfr.exe
LH C:\NET\net start basic

CONFIG.SYS

DEVICE=C:\DOS\SETVER.EXE
DEVICE=C:\WINDOWS\HIMEM.SYS
DOS=HIGH
LASTDRIVE=Z
STACKS=9,256


REM --- By HiSpeed CD-ROM Drive installation program. 1/23/2012 ---
DEVICE = C:\HXCD-ROM\CDROM.SYS /D:MSCD000


FILES=40
buffers=25
DEVICE=C:\dos\HIMEM.SYS
DEVICE=c:\dos\EMM386.EXE NOEMS
DEVICE=C:\NET\ifshlp.sys


Ancient operating systems

I've been bored lately and have taken to dusting off old OS discs and installing them in a virtual machine. However I ran into a little hitch installing Windows ME during the setup process. For the life of me, I couldn't get the install disk tools to format C:\ without problems.

To resolve the issue I had to mount the vdmk in windows, format to FAT32 in the host OS, then relaunch setup. Seemed to work flawlessly! I've tried replicating the issue and I have yet to get WinME tools to format the vdmk or even begin setup without doing this.

Saturday, January 21, 2012

Useful Shortcuts in your idle VM

No story just some useful shortcuts I use on my idle VMs.

TF2 Idle Mode:
Used to start up idle mode
"C:\Program Files\Steam\Steam.exe" -applaunch 440 -novid -textmode -nosound -dxlevel 80 -low -nopreload -sw -w 800 -h 600 -maxplayers 2 +sv_lan 1 +map "achievement_idle"

TF2 Clear Items:
Used to clear up 'hanging' items
"C:\Program Files\Steam\Steam.exe" -applaunch 440 -novid

Shortcut to Steamapps:
Used to rename profiles so I don't have a ton of profiles for every account. for example renaming idle1 to idle2
"C:\Program Files\Steam\steamapps"

IPConfig:
Useful for quickly getting the IP address of the VM. Yeah too lazy to setup the group policy to display it.
%windir%\system32\cmd.exe /K ipconfig

Speeding up VMs - Services you can disable

Modern day computers have no problems running multiple copies of Windows XP in virtual machines. However, this doesn't mean we don't want to use the host machine. Making sure Windows XP is as slim as possible is key to achieving this.

I routinely disable the following services and make these changes to nearly every Windows XP VM I create. These are considered "safe" to turn off. Since I'm only using these VMs for TF2 idling, I can go a bit crazy, I'll talk about those later.

The following services are set to "Manual"

Automatic Updates
Background Intelligent Transfer Service
Help and Support
Windows Firewall/Internet Connection Sharing
Security Center
Remote Registry

Set to Disabled
Print Spooler (Doubt you'll print from this VM)
Wireless Zero Configuration (No need to explain)
System Restore Service (You are cloning a template right?)
IMAPI CD-Burning COM Service (VMware will allow the VM to see your burner turning this on every time)

Also disabled in 'MSCONFIG'
You can never be too sure...

Indexing Service
Error Reporting Service
Event Log
Help and Support
NetMeeting Remote Desktop Sharing
Print Spooler
Security Center
Automatic Updates
Wireless zero conf

Indexing Service

Another very important thing (Most likely THE most important item to disable in a virtual environment) is the indexing service. This little resource hog continuously monitors your disk drives for minor file changes, eating a huge amount of IOPS (in/out operations per second) for a virtual machine.
There are two things to change.
In Services, fine indexing and change it to DISABLED
Then go to my computer, disk properties of the C drive, and uncheck "Allow Indexing Service" and apply to all of C:\ and sub folders. This may take a little bit. Click Ignore all when it attempts to modify a locked file.  This alone will speed things up greatly.

Virtual Memory Allocation

Virtual memory allows your computer with low physical ram to swap out some of that to disk, effectively making Windows think you have more memory than you do. We need this, but not in the way Windows XP handles it by default. Resizing the virtual memory file takes a LOT of resource, and when you run low on RAM, which you will when loading HL2.exe (Not during execution however) you will need some amount of virtual memory to get it running. Since the largest performance hit (outside of virtual memory itself, but thats another discussion) is the automatic resizing of the swap file itself. We can fix this by...

  • Right Click My Computer
  • Advanced Tab
  • Settings Button
  • Advanced Tab
  • Virtual Memory Settings Button
  • Select Custom Setting
  • Set Minimum to 512
  • Set Maximum to 512
  • Press 'Set'
  • Click OK
  • Restart the VM

I used 512mb in this example, and should be the minimum for a TF2 idle VM. If you find the VM or host running slower try playing with this number. You can also make sure Workstation itself is handling ram the way you need it to as well, see below for more.

Workstation Virtual Memory Swaping

Another way to speed up your VMs is to change the way workstation handles the memory allocated for each VM. There are three options:

Fit ALL virtual machine memory into reserved host ram.
Allow SOME virtual memory to be swapped. (Default)
Allow MOST virtual memory to be swapped.

Without going into detail about how swapping works, think of each option as a speed gauge from fastest to slowest, fastest being fit ALL virtual memory. You can shove more virtual machines running with the 'most' option, however everything will grind so slowly your host and guest machines will be nearly unusable if you have too many going. If you try to fit all virtual memory, they'll be fast and responsive, however you'll leave much less for the host machine to use. Try all of them and see which one is best.

This is a decent start, there are many other things you can do of course.

Thursday, January 19, 2012

Broken VMs after migration and playing with settings

Everything was great! Until I tried to load up 10 VMs at the same time and my desktop choked so badly screen refreshes was measurable in minutes. I had mistakenly set the memory for all my idle VMs to 64mb and tried to connect to an idle server. Once I got back from a shower, lunch and 7-11, i finally saw several out of memory errors. (I would of taken screenshots, but I didn't want to wait several hours for mspaint on my host to open ;) So I did what I normally do, kill the VMs, fix and relaunch.
All went well, or so I thought. At 0:00 GMT I launched up part of the team. To my surprise a few hours later, not a single account dropped any items! Flabbergasted I checked to see what went wrong.... None of the game instances loaded! I tried for an hour or two to resolve the issue, everything from deleting all settings and rebuilding shader and caches, to changing settings. I even redownloaded the entire TF2 on a new steam install in one VM and still, nothing worked. It seems that every VM that was running at the time of the memory issues all refuse to start hl2.exe. (Of course I was running a test to see just how many I could running before something like this happened, and the script didn't wait properly, so it ended up being EVERY FREAKING IDLE VM I HAD!) Even restoring snapshots didn't resolve the issue!

Oops.

Only one thing to do, start fresh. I had been wanting a new template VM for this project for a while, some things didn't sit right with me (20gb drive is not enough to have TF2, windows and several TF2 profiles, which btw take up 1gb of space each. Forgot to calculate that one)

So I created a new Windows VM, installed steam and got TF2 running properly, then took a look at the source wiki on command line options to speed things up.

My old settings:
"C:\Program Files\Steam\Steam.exe" -applaunch 440 -novid -textmode -nosound -nopreload -sw -maxplayers 2 +sv_lan 1 +map "itemtest"

New Settings:
"C:\Program Files\Steam\Steam.exe" -applaunch 440 -novid -textmode -nosound -dxlevel 80 -low -nopreload -sw -maxplayers 2 +cl_showfps 2 +sv_lan 1 +map "achievement_idle"

-dxlevel 80 : I noticed in Workstation 8, I was getting shader issues. This cleared it up
-low : Change the game to low priority, wasn't working before, seems to work now. (Throw back to Quakeworld ;)
+cl_showfps 2 : Shows FPS and map name/connection status. Doesn't always work, can't figure out why.. (ok its not designed for textmode but it WILL show up sometimes.. might disable)
+map "achievement_idle" : Lower footprint map than itemtest. Memory was reduced from 170~ avg to 95mb on this alone. (I think itemtest loads up models for testing, only thing I can think of) Note to self: Make smaller map with no lights for even faster speeds and less memory

So far I have 5 running in the background with my host running the game normally, no lag and very minor hicups on disk loading, but otherwise its much smoother with the new settings!

Wednesday, January 18, 2012

Migration from Workstation 6.5 to 8

I do this every time. Things are perfectly set up, exactly the way I want them to be, things run smoothly for a short time and... I have to change it all. In this case, I want to upgrade my older workstation 6.5 to 8. There are several new features I'd love to take advantage of, most importantly performance advances!

First thought, forced reboots? Really? I thought the days of Win9x were over. Once Workstation 8 was up and running, it was time to startup the idle VMs first, item drop reset is about to happen, have to get them going first.

Only one VM had any issues with upgrading the tools. Some sort of dll error that was solved with running the commands at the bottom. No big deal, Windows happens right? I also had to add back in the CD-ROM drive to my idle VMs, since I removed them for performance.
I also had to setup my networking again to fix the bridged connections. I had to manually force the bridge to the correct network adapter. Of the 4 physical adapters connected, it chose the one adapter that was disabled, media disconnected and has the incorrect drivers.
  • msiexec /unreg
  • msiexec /regserver
After configuring all the VMs and preparing them, I noticed the snapshot manager lags pretty badly when attempting to take multiple snapshots at a time. 6.5 never did this. 



Cool new features

  • Thumbnail view. When doing multiple things on several VMs, the thumbnail view can be extremely useful for keeping a tab on all your VMs at once. I love this thing.
  • Clone. Sure this was easy enough before, but now that it's included inside workstation, it does make it much easier to add on additional VMs without copying outside and renaming everything. This also keeps the filestructure much easier to read.
  • Shared VMs. Basically allowing a remote VNC connection to Workstation's management console. Ever start an idle session from a tablet? I now have, and it's awesome.
  • Automatic scaling of desktop from management view. Its no longer 1:1, if your VM's desktop is higher than the management console, it will scale it and keep it there without forcing numerous desktop resizings. (great for my Linux/BSD VMs which may or may not have X support for the tools)
All in all, I didn't have a single major issue migrating the idle VMs over to workstation 8. Now if the Linux and BSD VMs will be as easy...

Monday, January 16, 2012

Item drop differences between "premium" and F2P accounts, and stalling accounts

I've noticed an interesting way Valve has to push people into upgrading to premium status. I, like most people don't want to spend a hundred dollars for 20 accounts. That's quite a bit of coin for some fancy items in a database that really amount to "look at me! I have a cool hat!". While I build slowly on my premium upgrades, I've noticed a striking difference in item drops between the two types of accounts, above and beyond the not getting hats part.
On average, my premium accounts receive between 7 and 11 items per week. This is well within the bellcurve of the item drop system. See here for more information. However, my F2P accounts tend to stop at exactly 5 items a week, approximatively 50% of the time. (based on 50 data points, 24 accounts being exactly 5 item drops) While I don't have quite enough data points to make a full conclusion yet it seems quite apparent that Valve makes it much harder for F2P accounts to get items, even if as they claim, the drop system works the same way regardless of their payment status.
Another interesting problem I've found involves accounts stalling out in item drops. This happens when a particular account just stops getting any drops for weeks. To be fair, I think some of the problem is me forgetting to update my item yield spreadsheet, but it has happened on several occasions. To resolve the problem, I've had to load up the account on my main desktop, and play for several hours, actually sit there and play (annoying as I'm not leveling up my stranges...). This seems to jump start the accounts again. My request to Valve support has not been answered (which is odd, they tend to respond quickly, even if its just the generic piss off response).

Also just another tidbit of information. I've found that if you don't have the hl2 window focused while idling inside a VM, it tends to lose connection to steam, causing you to lose all hours put into it for that week. So make sure to keep those windows focused!