home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / bsd / 11751 < prev    next >
Encoding:
Text File  |  1993-01-24  |  8.5 KB  |  282 lines

  1. Xref: sparky comp.unix.bsd:11751 fj.os.386bsd:319
  2. Path: sparky!uunet!ccut!news.u-tokyo.ac.jp!yayoi!tansei1!mhiroshi
  3. From: mhiroshi@tansei.cc.u-tokyo.ac.jp (H. Murakami)
  4. Newsgroups: comp.unix.bsd,fj.os.386bsd
  5. Subject: [386bsd] Please, Oh please help my hang up trouble.
  6. Message-ID: <3980@tansei1.tansei.cc.u-tokyo.ac.jp>
  7. Date: 24 Jan 93 00:14:40 GMT
  8. Sender: news@tansei.cc.u-tokyo.ac.jp
  9. Followup-To: comp.unix.bsd
  10. Organization: Hokkaido Univ. However I am subject to tansei for JUNET.
  11. Lines: 269
  12.  
  13. To: comp.unix.bsd,fj.os.386bsd
  14. Subject: Please help my hang up trouble.
  15.  
  16. This is my two month long troubled problem.
  17.  
  18. I have 
  19.     486DX33MHz, AMI BIOS,
  20.     16MB of main memory,
  21.     1.6GB Fujitsu SCSI-2 DISK with AHA1542B board.
  22.  
  23. I allocates the swap area for 386bsd0.1 with Terry's patches
  24. and also other many patches including the new new scsi drivers.
  25.  
  26. I have been able to recompile all the
  27. sources associated with the 386bsd systems and other many many tools:
  28. {tex, gcc2.3.3, ...}.
  29.  
  30. I have allocated the just one giga bytes of swap area on the
  31. disk partition /dev/sd0b 
  32.  
  33. The standard configuration of the kernel 
  34. permits 32MB of data and stack areas per process.
  35. (I think the julian new new scci driver does nothing wrong with this
  36. problem.)
  37.  
  38. The enclosed test program "testvm.c" is just a toy program which will
  39. try to allocate 1MB size of memory region and then writes the 
  40. data on is repeated until the malloc fails.
  41.  
  42. I found, if I run the program as only one process, I rarely have
  43. problem. However, if I run that program, in many either by many
  44. login process, or by putting many process as the background jobs.
  45. The enclosed shell scripts "test3.sh" and "test6.sh" is the sample.
  46.  
  47. The symptom is, the system's COMPLETE death by hang up.
  48. Surely, the system goes heavier when too many paging or swapping
  49. starts after all the real memory was used. But hanging is a
  50. different thing. It's a wonderful life:
  51. (for example, nothing will happen for more than an hour,
  52. no response of the terminal,.. no disk updates, etc.)
  53.  
  54.  
  55. To experience the example of the hang up,
  56.     % cc testvm.c -o a.out
  57. and then
  58.     % sh test3.sh
  59. or
  60.     % sh test6.sh
  61.  
  62. Sometimes, your run may finish without the hang up.
  63. But in many trial, it will.
  64.  
  65. Since I have a giga bytes of swap area, even 6 processes is run,
  66. 32MB times 6 = less than 200MB is needed at most, is within the
  67. size of the swap area.
  68.  
  69.  
  70. The test3.sh tries to run three idential processes, and test6.sh
  71. tries to run six. The more processes, the possiblity of the problem
  72. grows.
  73.  
  74. I initially thought it is the problem in the malloc function
  75. coming with 386BDS0.1, so I also tried with the GNU's malloc routines.
  76. Surely the average time to the hang up became longer with GNU's
  77. malloc, but the chance of hang up did not vanished.
  78.  
  79. I now suspects that there is someplace in the kernel routines
  80. probably related with the extension of the stack frame,
  81. does not made properly.
  82.  
  83. Before, I go to increase the size of the virtual space size of the
  84. kernel by changing the parameters in vm_param.h or any place,
  85. the source of this trouble must be removed.
  86.  
  87. Please, help me !
  88.  
  89.     Hiroshi Murakami
  90.     hiroshi@teine.chem2.hokudai.ac.jp
  91.     mhiroshi@tansei.cc.u-tokyo.ac.jp
  92.  
  93. I have a dream,.. someday the 386bsd become a system of no bug...
  94.  
  95.  
  96. # This is a shell archive.  Save it in a file, remove anything before
  97. # this line, and then unpack it by entering "sh file".  Note, it may
  98. # create directories; files and directories will be owned by you and
  99. # have default permissions.
  100. #
  101. # This archive contains:
  102. #
  103. #    README
  104. #    test3.sh
  105. #    test6.sh
  106. #    testvm.c
  107. #
  108. echo x - README
  109. sed 's/^X//' >README << 'END-of-README'
  110. X
  111. XThis is my two month long troubled problem.
  112. X
  113. XI have 
  114. X    486DX33MHz, AMI BIOS,
  115. X    16MB of main memory,
  116. X    1.6GB Fujitsu SCSI-2 DISK with AHA1542B board.
  117. X
  118. XI allocates the swap area for 386bsd0.1 with Terry's patches
  119. Xand also other many patches including the new new scsi drivers.
  120. X
  121. XI have been able to recompile all the
  122. Xsources associated with the 386bsd systems and other many many tools:
  123. X{tex, gcc2.3.3, ...}.
  124. X
  125. XI have allocated the just one giga bytes of swap area on the
  126. Xdisk partition /dev/sd0b 
  127. X
  128. XThe standard configuration of the kernel 
  129. Xpermits 32MB of data and stack areas per process.
  130. X(I think the julian new new scci driver does nothing wrong with this
  131. Xproblem.)
  132. X
  133. XThe enclosed test program "testvm.c" is just a toy program which will
  134. Xtry to allocate 1MB size of memory region and then writes the 
  135. Xdata on is repeated until the malloc fails.
  136. X
  137. XI found, if I run the program as only one process, I rarely have
  138. Xproblem. However, if I run that program, in many either by many
  139. Xlogin process, or by putting many process as the background jobs.
  140. XThe enclosed shell scripts "test3.sh" and "test6.sh" is the sample.
  141. X
  142. XThe symptom is, the system's COMPLETE death by hang up.
  143. XSurely, the system goes heavier when too many paging or swapping
  144. Xstarts after all the real memory was used. But hanging is a
  145. Xdifferent thing. It's a wonderful life:
  146. X(for example, nothing will happen for more than an hour,
  147. Xno response of the terminal,.. no disk updates, etc.)
  148. X
  149. X
  150. XTo experience the example of the hang up,
  151. X    % cc testvm.c -o a.out
  152. Xand then
  153. X    % sh test3.sh
  154. Xor
  155. X    % sh test6.sh
  156. X
  157. XSometimes, your run may finish without the hang up.
  158. XBut in many trial, it will.
  159. X
  160. XSince I have a giga bytes of swap area, even 6 processes is run,
  161. X32MB times 6 = less than 200MB is needed at most, is within the
  162. Xsize of the swap area.
  163. X
  164. X
  165. XThe test3.sh tries to run three idential processes, and test6.sh
  166. Xtries to run six. The more processes, the possiblity of the problem
  167. Xgrows.
  168. X
  169. XI initially thought it is the problem in the malloc function
  170. Xcoming with 386BDS0.1, so I also tried with the GNU's malloc routines.
  171. XSurely the average time to the hang up became longer with GNU's
  172. Xmalloc, but the chance of hang up did not vanished.
  173. X
  174. XI now suspects that there is someplace in the kernel routines
  175. Xprobably related with the extension of the stack frame,
  176. Xdoes not made properly.
  177. X
  178. XBefore, I go to increase the size of the virtual space size of the
  179. Xkernel by changing the parameters in vm_param.h or any place,
  180. Xthe source of this trouble must be removed.
  181. X
  182. XPlease, help me !
  183. X
  184. X    Hiroshi Murakami
  185. X    hiroshi@teine.chem2.hokudai.ac.jp
  186. X    mhiroshi@tansei.cc.u-tokyo.ac.jp
  187. X
  188. XI have a dream,.. someday the 386bsd become a system of no bug...
  189. X
  190. END-of-README
  191. echo x - test3.sh
  192. sed 's/^X//' >test3.sh << 'END-of-test3.sh'
  193. Xa.out &
  194. Xa.out &
  195. Xa.out &
  196. END-of-test3.sh
  197. echo x - test6.sh
  198. sed 's/^X//' >test6.sh << 'END-of-test6.sh'
  199. Xa.out &
  200. Xa.out &
  201. Xa.out &
  202. Xa.out &
  203. Xa.out &
  204. Xa.out &
  205. END-of-test6.sh
  206. echo x - testvm.c
  207. sed 's/^X//' >testvm.c << 'END-of-testvm.c'
  208. X/* THE BEGINNING OF THIS TEST PROGRAM. */
  209. X
  210. X/*#define QUICK /* */
  211. X/*******************************************
  212. X*                                          *
  213. X*       Malloc dead-lock test program.     *
  214. X*                                          *
  215. X*******************************************/
  216. X
  217. X#define TYPE    int
  218. X#define MEGA    (1024*1024)
  219. X
  220. X#define SIZE (1000*MEGA) /* Size of total allocation limits in bytes. */
  221. X                         /* Note, the actual allocation size is determined
  222. X                            when the malloc's failure of allocation.  */
  223. X
  224. X#ifndef CHUNK_SIZE
  225. X# define CHUNK_SIZE     (MEGA-4) /* size of allocation unit in bytes. */
  226. X#endif
  227. X
  228. X#define NB (SIZE/CHUNK_SIZE)
  229. X
  230. X/*#define WAIT sleep(10) /* DO SLEEP */
  231. X/*#define WAIT sync() /* DO SYNC */
  232. X#define WAIT /* DO NOTHING. */
  233. X
  234. X#include <stdio.h>
  235. X#include <stdlib.h>
  236. X#include <unistd.h>
  237. X
  238. Xpid_t getpid(void), pid;
  239. Xchar *sbrk(int);
  240. X
  241. Xmain(void)
  242. X{
  243. X        int i, j;
  244. X        TYPE *(a[NB]);
  245. X
  246. X        pid = getpid();
  247. X        fprintf(stderr, "%4u: chunk_size=%d, nb=%d\n", 
  248. X                pid, CHUNK_SIZE, NB);
  249. X
  250. X        sleep(5);
  251. X        for(i=0;i<NB;i++) {
  252. X                WAIT;
  253. X                a[i] = (TYPE*) malloc(CHUNK_SIZE);
  254. X                if(a[i]==(TYPE*)0) 
  255. X                        break;
  256. X                fprintf(stdout, "%4u: block %d allocated. break %x\n", 
  257. X                        pid, i, (int)sbrk(0));
  258. X                WAIT;
  259. X#ifndef QUICK
  260. X                for(j=0;j<CHUNK_SIZE/sizeof(TYPE);j++)
  261. X                        (a[i])[j] = (TYPE)j;
  262. X#else /* QUICK */
  263. X                for(j=0;j<CHUNK_SIZE/sizeof(TYPE);j+=1024)
  264. X                        (a[i])[j] = (TYPE)j;
  265. X#endif
  266. X        }
  267. X
  268. X        fprintf(stdout, "%4u: No more allocation.\n", pid);
  269. X        for(j=0;j<i;j++) {
  270. X                fprintf(stdout, "%4u: block %d freed.\n", pid, j);
  271. X                free(a[j]);
  272. X                WAIT;
  273. X        }
  274. X
  275. X        fprintf(stderr,"%4u: Finished with block %d\n", pid, i-1);
  276. X        exit(0);
  277. X}
  278. X/* THE END OF THIS TEST PROGRAM. */
  279. END-of-testvm.c
  280. exit
  281.  
  282.