The critical section is a code segment where shared variables can be accessed. A race condition occurs when two processes attempt to access the same resource at the same time, which can cause crashes or errors. To solve this, processes must follow the principles of mutual exclusion, progress, and bounded waiting - only one process can be in the critical section at a time, no process is prevented from entering the critical section, and processes do not wait indefinitely. Process synchronization helps maintain consistency by allowing only one process to change shared memory at a time using variables or hardware.