# Random Hangs and Freezes



## Amzo (Aug 31, 2012)

Well I currently have two problems, but I think they're related. The first one is, my system locks up when I switch TTYs then switch back to X. The other one is when playing games, such as Warzone2100, ExtremeTuxRacer or pretty much any game, I always get random few seconds hangs, but the music and game still continues in the background. I didn't suffer from this on Linux.

Though, this is only with games, it doesn't happen when watching movies. Currently I am using the /usr/ports/x11/nvidia-driver-173 for my Nvidia card, which is a Geforce FX5200 as I'm thinking this is the most likely candidate, but not sure where to start to debug it.

My current configs are:

/etc/sysctl.conf


```
# $FreeBSD: src/etc/sysctl.conf,v 1.8 2003/03/13 18:43:50 mux Exp $
#
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#
   
# Disable coredump
kern.coredump=0

# Up the maxfiles to 4x default
kern.maxfiles=49312

# Allow users to mount CD's
vfs.usermount=1

# Enable more sound channels
dev.pcm.0.play.vchans=4
dev.pcm.0.rec.vchans=4

# Disable the system speaker
hw.syscons.bell=0

# Tune for desktop usage
kern.sched.preempt_thresh=224

# Enable shm_allow_removed
kern.ipc.shm_allow_removed=1
```

/boot/loader.conf


```
linux_load="YES"
nvidia_load="YES"

# Kernel Options
kern.ipc.shmseg=1024
kern.ipc.shmmni=1024
kern.maxproc=10000

# Load File-System Support
tmpfs_load="YES"

# Disable acpi throttle by default, fixes issues with powerd and later AMDs
hint.acpi_throttle.0.disabled="1"

# Fix crashes on 32bit with Nvidia
machdep.disable_mtrrs=1

# On some systems HPET is almost 2 times faster than default ACPI-fast
kern.timecounter.hardware=HPET
kern.hz=1000

# read performance is very important, increasing this sysctl tunable to 32
# or even more will demonstratively yield additional performance benefits.
vfs.read_max=32
```

Any help would be appreciated, I just don't know where to start. I should also mention, there has been no errors in my Xorg.conf, and also let me know what other logs or information you'll need.


----------

