JSI Tip 3108. How do I configure Opportunistic Locking on Windows NT and Windows 2000?

Windows NT and Windows 2000 enable Opportunistic Locking (Oplock) on both the Server service and Workstation service by default.

If a file is opened in a non-exlusive mode (deny none), with Exclusive Oplock, the redirector requests an oplock on the entire file. If no other process has the file open, the server will grant the oplock, giving the redirector exclusive access to the file, which allows read-ahead, write-behind, and lock caching.

When another process opens the file, the origonal owner is asked to Break Oplock or Break to Level II Oplock. The redirector must invalidate cached data, flush all writes and locks, and release the oplock (or close the file).

Opportunistic Locking level II is a method for granting read access to a file by more than one workstation. These workstations can read-ahead (cache locally), as long as no station writes to the file. When any workstation sends a write request, the server returns the write response and then asks all workstation that have the file open to Break to None, releasing any oplock. Since these workstations have no cached writes or locks, they simply invalidate their cache,without the need to respond to the Break to None.

To manage Opportunistic Locking, you can configure both the Workstation and/or Server service, using Regedt32.

To configure the Workstation service, navigate to:


Edit or Add Value name UseOpportunisticLocking, as a REG_DWORD data type. The default setting is 1 (true). A data value of 0 disables the oplock performance enhancement, and should only be used when you are trying to isolate a problem.

To configure the Server service, navigate to:


The following 4 REG_DWORD value names can be configured:

 Value Name   Default 
 D e s c r i p t i o n 
 1 (true) 
 0 or 1 
 A value of 0 will deny all clients the ability to use oplocks on this connection. 
 0 - x'ffffffff'
bytes per second.
 The minimum throughput before the server disables raw and opportunistic locks for this connection. 
 0 - 100,000 seconds. 
 If delays exceed this number, the server disables raw I/O and opportunistic locks for this connection. Raw I/O is an optimizing feature that permits the Server service to send unsegmented data across the network. Because raw I/O can cause delays, the service disables it in an attempt to resolve the delay. 
 10 - 180 seconds. 
 The time that the server waits for clients to respond to an oplock break request. 

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.