home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 36 Tips / 36-Tips.zip / osotperf.txt < prev    next >
Text File  |  1997-03-24  |  19KB  |  396 lines

  1. OSOTPERF - OS/2 WARP PERFORMANCE, TUNING
  2. 09/12/96
  3. =======================================================================
  4. OS/2 Warp Performance, Tuning
  5. =======================================================================
  6. Please Read Entire Document for Full Explanation of Procedures
  7. --------------------------------------------------------------
  8. DESCRIPTION
  9.  
  10. Performance, tuning questions
  11.  
  12. RESOLUTION
  13.  
  14. Before covering OS/2 system tuning let's review the concept of threads 
  15. and how they are used in OS/2. Every program that you run on an OS/2 
  16. system will process as one or more threads. All programs, DOS, Windows, 
  17. and OS/2, use a minimum of one thread. Each thread executes at a given 
  18. priority. The priority is used by OS/2 to determine which thread gets 
  19. to run when more than one thread is ready to run. The highest-priority 
  20. thread that is ready to run will be the one dispatched by the system 
  21. and given time to run. It is given what is referred to as a "time 
  22. slice". This is a set period of time during which
  23. a thread is allowed to run. After this time has expired, the 
  24. highest-priority thread that is ready to run will be given it's own 
  25. time slice in which to run. If the same thread still wanted to run, and 
  26. it was the highest-priority thread, it would receive another time slice 
  27. to run in.
  28.  
  29. OS/2 programs usually run at normal priority, which is 200. Under 
  30. program control, the program can change its priority to be server class 
  31. (300), or time-critical (800). It can also change its subclass priority 
  32. between 0 and 31. A thread that has a priority of 200 and a subclass of 
  33. 15 has a higher effective priority than a thread with priority 200 and 
  34. subclass 0, and therefore runs first. All DOS and Windows applications 
  35. always run at priority 200. In OS/2 Warp, we have added the capability 
  36. to define the subclass priority for DOS and Windows applications. Care 
  37. should be taken when using this subclass priority since it may cause 
  38. other programs to run slower or generate errors in the case of 
  39. communication applications that do not get the subclass boost.
  40.  
  41. OS/2 Warp will give OS/2 threads a priority boost for specific types of 
  42. functions and states. A priority boost means that the priority of the 
  43. thread is changed for a given time slice to give it higher priority 
  44. than other threads. This allows these threads to process more quickly 
  45. and therefore improve their responsiveness to the user. Following is a 
  46. list of priority boosts that can be given to a thread. They appear in 
  47. descending order.
  48.  
  49. Disk I/O
  50.  
  51. When an interrupt is received stating that a disk operation has 
  52. completed, the thread that processes this state will receive a priority 
  53. boost for one time slice to process this interrupt. This applies to 
  54. threads whose process has foreground focus. Foreground focus means the 
  55. process that owns the window that is highlighted on the computer screen.
  56.  
  57. Starved
  58.  
  59. In the CONFIG.SYS file, there is a statement MAXWAIT=3. The number 3 
  60. specifies how many seconds a thread can be in the ready-to-run state 
  61. without having received time to run. If a thread had been waiting to 
  62. run for 3 seconds, or whatever value is specified in the MAXWAIT 
  63. statement, its priority would be raised to give it an opportunity to 
  64. run.
  65.  
  66. Keyboard
  67.  
  68. This is a boost in priority given to a thread when it is interacting 
  69. with the system keyboard.  Basically, it is for accepting typed in data.
  70.  
  71. Foreground
  72.  
  73. This is a priority boost given to all threads of the program that owns 
  74. the active window on the OS/2 screen (the one that is highlighted).
  75.  
  76. Windowed
  77.  
  78. Threads which have windows showing on the display will also receive a 
  79. priority boost when drawing or writing into that window.
  80.  
  81. When a thread is in more than one of these states, the system will 
  82. combine the states and give a priority based on the combined states.
  83.  
  84. For DOS and Windows applications, the Foreground, Windowed, and keyboard
  85.  states do not apply. The routine that handles the mouse or keyboard 
  86. interrupt will receive a boost in priority to handle the interrupt, but 
  87. the application does not receive a priority boost. If the DOS Setting 
  88. INT_DURING_IO is specified, a second thread is used to handle the I/O 
  89. interrupt, and that thread is given an interrupt boost.
  90.  
  91. Idle class is the other priority class that exists in OS/2.  This 
  92. priority level runs only when nothing else in the system wants to run. 
  93. Threads in this class will not receive any of the state boosts. If DOS 
  94. and/or Windows applications are being run, then you should avoid the 
  95. use of threads that run in idle class because they may never run but 
  96. will take up system space.
  97.  
  98. CONFIG.SYS Statements
  99.  
  100. Now let's look at specific things in the CONFIG.SYS file that you can 
  101. change to affect the performance of your system.  First we cover those 
  102. statements that you should not modify unless you have a system which 
  103. has a special use, such as a process control system. An example would 
  104. be a system used to monitor a manufacturing machine or chemical 
  105. process, where timing and response time are critical factors.
  106.  
  107. PRIORITY_DISK_IO=YES
  108.  
  109. This allows the application that has screen focus to receive a priority 
  110. boost when its disk operation is complete. This applies to the first 
  111. time slice given to the thread after the disk operation is complete. 
  112. After the time slice, the state is reset for the thread and the 
  113. priority boost removed. 
  114.  
  115. PRIORITY=ABSOLUTE
  116.  
  117. Problematic in that all threads with lesser priority will never run.
  118.  
  119. MEMMAN=SWAP,PROTECT
  120.  
  121. Allows OS/2 to swap program instructions and data to disk when more 
  122. memory is needed than is physically available in your computer. If you 
  123. do not specify SWAP, you will need enough physical memory in your 
  124. computer to hold all the program instructions and data that OS/2 and 
  125. your application needs to run. You do not pay a penalty by specifying 
  126. SWAP and then not needing to use it.
  127.  
  128. The PROTECT parameter allows Dynamic Link Libraries ( DLL) to allocate 
  129. protected memory. Protected memory is memory that is protected from 
  130. being accessed by unauthorized programs.
  131.  
  132. You can also specify a COMMIT parameter. This forces the system to 
  133. ensure that enough physical memory or swap file disk space is available 
  134. for a memory object when it is created. Normally, OS/2 commits physical 
  135. and disk memory when the page of memory is actually touched. Specifying 
  136. this parameter can significantly increase the amount of space your swap 
  137. file uses on disk. You would usually only specify COMMIT if you were 
  138. developing applications or systems and wanted to see what the maximum 
  139. amount of memory and disk space that could be required for your system.
  140.  
  141. TIMESLICE=X,Y
  142.  
  143. This statement is not found in the CONFIG.SYS file after you install 
  144. OS/2 but is sometimes recommended to be added. This was okay to add for 
  145. OS/2 2.0, 2.1 or 2.11 systems, but not for OS/2 Warp. In OS/2 Warp, we 
  146. dynamically modify a thread's time slice based on actions that have 
  147. occurred. For instance, if a thread took a page fault during its time 
  148. slice, we give it an extra time slice to process what is contained in 
  149. the faulted page. We also give applications doing disk I/O extra time 
  150. slices if the data they are reading is in the disk cache. When the 
  151. TIMESLICE= parameter is used, none of these actions will occur. 
  152. Instead, each thread will be given the minimum time slice of X, and its 
  153. time slice will not be allowed to go beyond value Y.
  154.  
  155. PRIORITY=DYNAMIC
  156.  
  157. If DYNAMIC is not specified, then each thread will only run at the 
  158. priority that has been assigned to it by the developer of the code. 
  159. None of the priority state boosts described earlier will be applied.
  160.  
  161. DEVICE=C:\OS2\BOOT\VDISK.SYS
  162.  
  163. This statement allocates a virtual disk in your computers physical 
  164. memory. It is used for quick access to often-used files and programs. 
  165. This was good for a DOS environment where the extra memory in your 
  166. computer was not used by DOS, but OS/2 uses this memory, and your 
  167. performance can be adversely affected if a VDISK is used. It is much 
  168. better to increase the size of the disk cache if you have unused
  169. physical memory than it is to use VDISK.
  170.  
  171. Now let us look at statements in the CONFIG.SYS file which you should 
  172. change to help improve the performance of your OS/2 Warp system.
  173.  
  174. LIBPATH=
  175.         
  176. This tells the system where to find DLL files and printer device 
  177. drivers that OS/2 Warp and applications use. Place the directory names 
  178. in order of usage. The most accessed directory should be first, the 
  179. least used last. If possible, place the DLL used by a program in the 
  180. same directory as the working directory when the program is running. 
  181. Then, you do not need to add that directory to the LIBPATH statement. 
  182. Also, place all directories that are on a network at the end of your 
  183. LIBPATH statement in case the network goes down and they cannot be 
  184. accessed. When you try to access a network drive that is not active, 
  185. you will have to wait for an error time to occur before processing can 
  186. continue. This can be as much as 15 seconds or longer. See the 
  187. discussion of dynamic LIBPATH support later on in this document for 
  188. additional considerations when accessing network drives.
  189.  
  190. SET PATH=
  191.         
  192. PATH is used to specify where OS/2 Warp searches for executable program 
  193. files, such as .EXE, .COM, .CMD, and .BAT. Place the directories in 
  194. order of most used first, least used last. If programs will be executed 
  195. from an object on your desktop or folder, specify the path there and 
  196. not in the PATH statement. Only place directories in the PATH statement 
  197. for executable files that will be called from other programs, command 
  198. interpreters, or command line interfaces.
  199.  
  200. SET DPATH=
  201.  
  202. The same principle applies to DPATH as PATH and LIBPATH. For resources 
  203. that applications use, place the most used directories first and the 
  204. least used last. DPATH is used to define the search path for finding 
  205. data files.
  206.  
  207. BUFFERS=90
  208.  
  209. Buffers are physical memory used to support partial sector reads and 
  210. writes in a FAT (file allocation table) file system environment. They 
  211. are also used to cache FAT directory entries and for swap file disk 
  212. I/O. Because BUFFERS are used to cache FAT directory entries, this 
  213. number should not be reduced
  214. below 60, unless you are not using the FAT file system on your disks. 
  215. Reducing this number will increase the number of disk reads that are 
  216. done to the FAT directory entries and therefore slow down your system.
  217.  
  218. MAXWAIT=3
  219.  
  220. This specifies the maximum amount of time that a thread will be in a 
  221. ready-to-run state without receiving a time slice to run in. After this 
  222. time expires, the thread will be given a boost in priority so it gets a 
  223. chance to run. Reducing this value to 2 may help in systems where there 
  224. are a lot of programs running, or multiple separate DOS/Windows 
  225. programs running. Reducing it to 1 on systems where there is swap 
  226. activity taking place can slow down the system.
  227.  
  228. DISKCACHE=D,LW,t,AC:
  229.  
  230. This is used to specify the amount of physical memory set aside to 
  231. cache data that is being read from or written to disk partitions that 
  232. are formatted for FAT. When OS/2 Warp sees "D" specified in the 
  233. DISKCACHE statement, it will allocate a disk cache size from 48K to 
  234. 4MB, based on the amount of physical memory you have in your system. If 
  235. you have more than 8 MB in your system, D will cause 10% of your 
  236. system's physical memory to be used for the FAT disk cache. Instead of 
  237. specifying D in the DISKCACHE statement, you should change it to the 
  238. actual amount of disk cache space you require. If you have a system 
  239. where your programs do not do much disk I/O or where your memory is 
  240. being used up by your applications, you may want to set this value to 
  241. 128. Also, reduce this value if you are using the DB/2 product or any 
  242. other product that provides its own disk data caching. If you have a 
  243. system that has lots of memory, then you can specify a number bigger 
  244. than 4MB. The maximum allowed is 14.4 MB.
  245.  
  246. The t parameter is not defined in the default CONFIG.SYS file. It 
  247. defines the cache threshold for records that go into the cache. The 
  248. default value is 4. This means that any record that is 4 sectors or 
  249. less will go into the cache, while those greater than 4 sectors will 
  250. not. If your disk cache size is 128K or larger, add this parameter to 
  251. the disk cache statement. If known, set this value to the largest 
  252. record size used. Otherwise, set the value to 32. The range can be from 
  253. 2K ( 4 sectors) up to 64K. 32 is a good starting point and is big 
  254. enough to handle most applications and program executable files.
  255.  
  256. The LW parameter activates the Lazy Write or write behind feature. This 
  257. allows the application to get control back before the data is actually 
  258. written to disk. A separate thread will write the data from the cache 
  259. to the disk when necessary or opportune to do so. You should always use 
  260. this option, and code your applications to open files with a cache 
  261. bypass option if disk data security is imperative.
  262.  
  263. The AC:  parameter is used to specify which FAT directories should be 
  264. checked at system boot time to see if they were left in an 
  265. unpredictable state when the system was last powered off. This usually 
  266. occurs when the power is lost to your machine and you had not done a 
  267. Shutdown or Ctrl-Alt-Del key sequence prior to losing power. The disk 
  268. directories specified here will have CHKDSK run against them to clean 
  269. up any lost files or abandoned clusters.
  270.  
  271. SWAPPATH=d,r,s
  272.  
  273. SWAPPATH specifies where code and data pages are swapped to on disk 
  274. when more physical memory is needed than is available in your system. 
  275. The d parameter represents the path where your SWAPPER.DAT file is 
  276. located. For systems which have multiple partitions or multiple disks, 
  277. this should be placed on the most used directory of the least used 
  278. disk. Also, try to physically locate the swap file on the disk based on 
  279. its usage. If you are doing a lot of swap activity, place the swap file 
  280. at the start of the disk. If is it rarely used, place it at the end.
  281.  
  282. The s parameter specifies the size that the swap file is initialized to 
  283. when you start your OS/2 Warp system. Make this large enough so that it 
  284. does not have to grow in size while you are running your programs. You 
  285. should perform your normal computer functions and look at the size of 
  286. the swap file when you have the most activity. Then set the value of 
  287. the s parameter to this size in the CONFIG.SYS file.  If you are using 
  288. the FAT file system, IPL your system under DOS, delete the SWAPPER.DAT 
  289. file, defragment the disk partition where the swap file will be 
  290. located, and then IPL your OS/2 system. This should keep your swap file 
  291. from getting fragmented.
  292.  
  293. The r parameter specifies the amount of free space that must be in the 
  294. swap file's drive. The default for this value is adequate and only 
  295. needs to be changed if you want to be warned earlier about a possible 
  296. out-of-memory situation.
  297.  
  298. THREADS=
  299.  
  300. THREADS defines how many threads the system will be able to use. One 
  301. page of resident memory is need for approximately every 32 threads that 
  302. are defined. This memory will be allocated at the time the system is 
  303. started. As a minimum, you will need 80 threads to support the base 
  304. OS/2 Warp system and 3 or 4 OS/2, DOS or Windows applications. The 
  305. system will support up to 64000 threads, but typically you will not 
  306. have enough memory in your system to support more than 300 to 500 
  307. threads. 18 threads are required for LAN Server 4.0, and 12 for 
  308. Personal Communications/3270. You will need an additional 2 threads for 
  309. each Personal Communications/3270 session that is started.
  310.  
  311. To calculate the number of threads that you will need in your system, 
  312. use the formula 54+(2xN)+10 where N is the number of programs that you 
  313. will run together. If the program requires more than 2 threads, add in 
  314. the additional threads. This will insure that you have enough threads 
  315. in most cases.
  316.  
  317. To determine how many threads you are using at any given time, run the 
  318. PSTAT command from an OS/2 command line. This will show all of the 
  319. processes that are running on your system, as well as how many threads 
  320. each process is using. The output is quite long, so you may want to 
  321. redirect it to file.
  322.  
  323. Additional considerations
  324.  
  325. You should only install the devices drivers that your programs actually 
  326. need to run. Do not install extra communication, printer, video or 
  327. device drivers if they will not be used. Below is a list of device 
  328. drivers and virtual device drivers that are normally found in 
  329. CONFIG.SYS and that may not be needed.  
  330. (Virtual device drivers are used to support DOS and Windows 
  331. applications and usually have a V at the beginning of their name.)
  332.  
  333. VEMM.SYS
  334.  
  335. Used to support Expanded Memory use in DOS and Windows programs.
  336.  
  337. VXMS.SYS
  338.  
  339. Supports Extended Memory in DOS and Windows applications.
  340.  
  341. VDPMI.SYS
  342.  
  343. Supports the DPMI memory access and is required to support all Windows 
  344. applications.
  345.  
  346. VW32S.SYS
  347.  
  348. Supplies support for the WIN32S Windows APIs. Not needed for Windows 
  349. programs that do not use WIN32S APIs. 
  350.  
  351. IBMxFLPY.ADD (where x is either 1 or 2)
  352.  
  353. 1 is used for family 1 machines and 2 is for MCA (Micro-Channel 
  354. Architecture )
  355. machines. You do not need both.
  356.  
  357. XDFLOPPY.FLT
  358.  
  359. This is required for reading diskettes which are written using the XDF 
  360. (Extended Disk Format) format. These are usually OS/2 and PCDOS 7 
  361. installation, printer, and video driver diskettes and possibly CSD 
  362. diskettes. The OS/2 Warp Install and Disk 1 diskettes do not use the 
  363. XDF format.
  364.  
  365. COM.SYS and VCOM.SYS
  366.  
  367. Only required if you will be doing serial or async communications.
  368.  
  369. If you use the selectable CONFIG.SYS option in the Archive and Recovery 
  370. feature of OS/2 Warp, it is possible to create multiple CONFIG.SYS 
  371. files which will contain different device drivers based on your needs. 
  372. For example, you could create one CONFIG.SYS file that is used for 
  373. maintenance and installation. This one would include XDFLOPPY.FLT and 
  374. both IBMxFLPY.ADD drivers, plus additional threads. Another CONFIG.SYS 
  375. used for normal processing could have these device drivers removed and 
  376. a lower number of threads. When maintenance has to be applied to the 
  377. system, or some additional new products installed, you
  378. could restart the machine with the Archive and Recovery Choices menu 
  379. active and select the proper CONFIG.SYS to be used. An extension of 
  380. this would be to archive the CONFIG.SYS and the OS/2 INI files and 
  381. select those to apply maintenance.
  382.  
  383.  
  384.  
  385. ______________________________________________________________________
  386. IBM disclaims all warranties, whether express or implied, including 
  387. without limitation, warranties of fitness and merchantability with 
  388. respect to the information in this document. By furnishing this 
  389. document, IBM grants no licenses to any related patents or copyrights.  
  390. Copyright (c) 1994, 1995 IBM Corporation. Any trademarks and product 
  391. or brand names referenced in this document are the property of their 
  392. respective owners. Consult your product manuals for complete trademark 
  393. information. 
  394.  
  395.  
  396.