Return-Path: lccheung@usc.edu Delivery-Date: Mon Aug 1 19:24:13 2005 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j722OD3e028733 for ; Mon, 1 Aug 2005 19:24:13 -0700 Received: from smtp111.sbc.mail.mud.yahoo.com ([68.142.198.210]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with SMTP id <0IKK002HXPNIXH80@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Mon, 01 Aug 2005 19:30:54 -0700 (PDT) Received: (qmail 45766 invoked from network); Tue, 02 Aug 2005 02:30:54 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@71.130.56.210 with login) by smtp111.sbc.mail.mud.yahoo.com with SMTP; Tue, 02 Aug 2005 02:30:53 +0000 Date: Mon, 01 Aug 2005 19:30:45 -0700 From: Leslie Cheung Subject: Re: status response message To: cs551@merlot.usc.edu Message-id: <0IKK002HYPNIXH80@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWXCi+8fgBE4S8MSDugaq3nK6GrPQ== Someone wrote: >Since the status response does not contain a file uoid, we cannot print a >file uoid as you said. >Can we omit the fild uoid but print only meta file? Yes. My previous message (with timestamp Wed 20 Jul 23:58) comes before the spec has changed. To summarize, we are looking for the following info in a file status response message. 1) On which node a file resides 2) File metadata Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Jul 22 14:27:12 2005 Received: from msg-mx4.usc.edu (msg-mx4.usc.edu [128.125.137.9]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6MLRC3e012135 for ; Fri, 22 Jul 2005 14:27:12 -0700 Received: from smtp113.sbc.mail.mud.yahoo.com ([68.142.198.212]) by msg-mx4.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with SMTP id <0IK100DM7T7UV0F0@msg-mx4.usc.edu> for cs551@merlot.usc.edu; Fri, 22 Jul 2005 14:33:30 -0700 (PDT) Received: (qmail 9910 invoked from network); Fri, 22 Jul 2005 21:33:29 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@71.129.181.82 with login) by smtp113.sbc.mail.mud.yahoo.com with SMTP; Fri, 22 Jul 2005 21:33:29 +0000 Date: Fri, 22 Jul 2005 14:33:23 -0700 From: Leslie Cheung Subject: nunki is UP In-reply-to: <0IK000FKQS957110@msg-mx4.usc.edu> To: cs551@merlot.usc.edu Message-id: <0IK100DM8T7UV0F0@msg-mx4.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWOlXRtzVWN6vlPRhekT9jN7C7t3QAbzKgg As of now (Jul22, 2:30pm) nunki is up and running. So get back to work and good luck! Leslie >-----Original Message----- >From: Leslie Cheung [mailto:lccheung@usc.edu] >Sent: Friday, July 22, 2005 1:15 AM >To: cs551@merlot.usc.edu >Subject: nunki is down > > >Some of you have sent me email saying that nunki is down. Apparently, nunki >is now up, BUT for some reasons we cannot login. The time is now 1:11am, Jul >22. If it's not up by tomorrow, I'll check with ISD. > >Leslie > Return-Path: lccheung@usc.edu Delivery-Date: Fri Jul 22 01:08:49 2005 Received: from msg-mx4.usc.edu (msg-mx4.usc.edu [128.125.137.9]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6M88n3e006495 for ; Fri, 22 Jul 2005 01:08:49 -0700 Received: from smtp107.sbc.mail.mud.yahoo.com ([68.142.198.206]) by msg-mx4.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with SMTP id <0IK000FKPS957110@msg-mx4.usc.edu> for cs551@merlot.usc.edu; Fri, 22 Jul 2005 01:15:05 -0700 (PDT) Received: (qmail 23567 invoked from network); Fri, 22 Jul 2005 08:15:05 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@71.129.181.82 with login) by smtp107.sbc.mail.mud.yahoo.com with SMTP; Fri, 22 Jul 2005 08:15:04 +0000 Date: Fri, 22 Jul 2005 01:15:00 -0700 From: Leslie Cheung Subject: nunki is down To: cs551@merlot.usc.edu Message-id: <0IK000FKQS957110@msg-mx4.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWOlXRtzVWN6vlPRhekT9jN7C7t3Q== Some of you have sent me email saying that nunki is down. Apparently, nunki is now up, BUT for some reasons we cannot login. The time is now 1:11am, Jul 22. If it's not up by tomorrow, I'll check with ISD. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Thu Jul 21 19:57:36 2005 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6M2va3e024470 for ; Thu, 21 Jul 2005 19:57:36 -0700 Received: from smtp114.sbc.mail.mud.yahoo.com ([68.142.198.213]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with SMTP id <0IK000HW9DUFG690@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Thu, 21 Jul 2005 20:03:52 -0700 (PDT) Received: (qmail 41164 invoked from network); Fri, 22 Jul 2005 03:03:51 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@69.231.24.155 with login) by smtp114.sbc.mail.mud.yahoo.com with SMTP; Fri, 22 Jul 2005 03:03:51 +0000 Date: Thu, 21 Jul 2005 20:03:41 -0700 From: Leslie Cheung Subject: Re: UOID and Nonce of file To: cs551@merlot.usc.edu Message-id: <0IK000HWADUFG690@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWOafcIvuNg4HY/SKGlYrjO3seSJQ== Someone wrote: >If nonce is not the same as uoid, then how and where in the store message >is the uoid of a file sent to other nodes? When the originating node sends >a store message to other nodes, the message has the uoid of the message >in its header, but where in the message can we store the uoid of the file? >The only place i can see is in the file metadata section. But in the >specs, there is no UOID field in the file metadata. There is only a Nonce >field. So it would make sense for Nonce to be the same as the uoid of a >file. Unless there is another way... I am sorry; I should have made it clear in my last message. When a node, say node A, stores a file, it first generates a Nonce, bit vector and other metadata for this file. Then A generates a UOID of this file, and stores it in its permanent storage. After that, A floods a "store" message to all other nodes. Now let's say node B got this message and decides to store this file. B generates a UOID of this file (which is different from that of the same file on A), and store it in its permanent storage. The metadata (including Nonce) is unchanged. Both A and B have the file with the same Nonce (and other metadata), but different UOIDs. So the answer to your question is, you do not need to put a UOID of a file in the store message; it's the node who decides to store the file generate a UOID for it. And the same thing applies to "cache files". Leslie Return-Path: lccheung@usc.edu Delivery-Date: Thu Jul 21 12:54:51 2005 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6LJsp3e005102 for ; Thu, 21 Jul 2005 12:54:51 -0700 Received: from smtp101.sbc.mail.mud.yahoo.com ([68.142.198.200]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with SMTP id <0IJZ004T5U9UQ990@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Thu, 21 Jul 2005 13:01:06 -0700 (PDT) Received: (qmail 95748 invoked from network); Thu, 21 Jul 2005 20:01:06 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@69.231.24.155 with login) by smtp101.sbc.mail.mud.yahoo.com with SMTP; Thu, 21 Jul 2005 20:01:05 +0000 Date: Thu, 21 Jul 2005 13:01:01 -0700 From: Leslie Cheung Subject: Re: Check Message? To: cs551@merlot.usc.edu Message-id: <0IJZ004T6U9UQ990@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWOLutH0/QNvfhYThGzhsYGXuSRnw== Someone wrote: >How long do we wait for the check response before restarting? How long do you wait for JOIN messages before choosing your neighbors? You can make a similar assumption here. For example, you can wait "MsgLifetime" amount of time, or derive the wait time from "MsgLifetime", 5 seconds, 10 seconds, etc. Just do something make sense (waiting for 1 microsecond probably does not make sense...). Make sure you document this in your README. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Wed Jul 20 23:52:35 2005 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6L6qZ3e001105 for ; Wed, 20 Jul 2005 23:52:35 -0700 Received: from smtp102.sbc.mail.mud.yahoo.com ([68.142.198.201]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with SMTP id <0IJY005JWU213Q80@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Wed, 20 Jul 2005 23:58:49 -0700 (PDT) Received: (qmail 78355 invoked from network); Thu, 21 Jul 2005 06:58:49 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@69.231.24.155 with login) by smtp102.sbc.mail.mud.yahoo.com with SMTP; Thu, 21 Jul 2005 06:58:48 +0000 Date: Wed, 20 Jul 2005 23:58:45 -0700 From: Leslie Cheung Subject: Re: status response message To: cs551@merlot.usc.edu Message-id: <0IJY005JXU213Q80@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWNwaMmKTbW9qVrQ12ksCyIsF3Ceg== Someone wrote: >When status type for the status message is 0x02 (files information), the >status response message contains meta data. >Does the meta data means all meta data including permant storage and cache? >That is, does the status response message for file information contains meta >files for all files, which are in a node? "status files" output should include both permanent files and cache files. >Furthermore, I have no idea how to write for status file command. >Can you give me example format like status.out (nam file)? We have not specified the format for "status files" output. So you are welcome to use your own format. The information we are looking for is 1) on which node a file resides, 2) uoid of the file, and 3) file metadata. One possible format could be ------------------------------------------- nunki.usc.edu:20000 [1] 2e560b... [metadata] FileName=helloWorld.txt FileSize=... [2] e07ab2... [metadata] ..... ----------------------------------------------- nunki.usc.edu:18000 [1] e07ab2... [metadata] ..... ----------------------------------------------- Leslie Return-Path: lccheung@usc.edu Delivery-Date: Wed Jul 20 18:22:11 2005 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6L1MB3e018325 for ; Wed, 20 Jul 2005 18:22:11 -0700 Received: from smtp102.sbc.mail.mud.yahoo.com ([68.142.198.201]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with SMTP id <0IJY00LUTERCJD00@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Wed, 20 Jul 2005 18:28:24 -0700 (PDT) Received: (qmail 42993 invoked from network); Thu, 21 Jul 2005 01:28:24 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@69.231.24.155 with login) by smtp102.sbc.mail.mud.yahoo.com with SMTP; Thu, 21 Jul 2005 01:28:23 +0000 Date: Wed, 20 Jul 2005 18:28:19 -0700 From: Leslie Cheung Subject: Re: Final project questions To: cs551@merlot.usc.edu Message-id: <0IJY00LUUERCJD00@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Thread-index: AcWNk3mikjkkGyzWT4S678oV/gd2Yw== Someone wrote: >1) When entering a STORE command, can the user enter duplicate tag names >for keywords. For eg, is > store abc.mp3 30 type="audio" type="mp3" artist="xyz" >a valid command? It's up to you. If you allow duplicate keys, I don't think it affects the bit-vector and search results. >2) When attempting to store a file (using the store command), if a node >discovers that the permanent memory is full, then it won't store and serve >the file. But should it still probabilistically flood the store message to >the network so that other nodes with cache space can store the file? It should not flood the message. Just tell the user the storage is full. >3) When are the private.pem and cert.pem files ever re-created? When the >-reset option is used? Or, does the node simply never re-create them if >they already exist in the HomeDir? You should create public/private keys when you starts your node and do not see these in the home directory. Even when your node start with "-reset", I don't think it changes these keys.If you choose to generate them every time you start a node, I think it's ok too. The bottom line is you should have already generated public/private keys before you use them. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Tue Jul 19 19:29:28 2005 Received: from msg-mx4.usc.edu (msg-mx4.usc.edu [128.125.137.9]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6K2TR3e019193 for ; Tue, 19 Jul 2005 19:29:27 -0700 Received: from mxsf34.cluster1.charter.net ([209.225.28.159]) by msg-mx4.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with ESMTP id <0IJW00MNEN7E2DA0@msg-mx4.usc.edu> for cs551@merlot.usc.edu; Tue, 19 Jul 2005 19:35:39 -0700 (PDT) Received: from mxip03a.cluster1.charter.net (mxip03a.cluster1.charter.net [209.225.28.133]) by mxsf34.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id j6K2ZbWX000585 for ; Tue, 19 Jul 2005 22:35:37 -0400 Received: from 66-215-4-155.pas-mres.charterpipeline.net (HELO lesliee502e195) (66.215.4.155) by mxip03a.cluster1.charter.net with ESMTP; Tue, 19 Jul 2005 22:35:37 -0400 Date: Tue, 19 Jul 2005 19:35:30 -0700 From: Leslie Cheung Subject: RE: Mini File System naming To: cs551@merlot.usc.edu Message-id: <43vthu$12brc62@mxip03a.cluster1.charter.net> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Thread-index: AcWM07IkBHsA60LnSty7O/ckkQS3xQ== X-IronPort-AV: i="3.93,301,1115006400"; d="scan'208"; a="1153282242:sNHT17799462" Someone wrote: >The spec says that a file name such as "1.meta" must never be reused >unless a node is reset. So does that mean that every time the "-reset" >option is used or every time a node is disconnected from the network >(because of failure to receive CKRS) and is forced to re-join the network >by sending JNRQ, the permament and cached files are deleted and file names >such as "1.meta" can be reused? We can reuse a file name only if we start a node with "-reset". If a node quits due to other reasons (user type in "shutdown", not enough neighbors when doing JOIN, failure to receive check response, etc), it should NOT reuse any file name. >Basically, is there ever a time (other than when a delete message is flooded) that >files from the permament memory are deleted? You also delete files in permanent storage when we start a node with "-reset". The point here is that we want to keep all files even if a node crashes, being shutdown, or for whatever reasons it has to terminate. The only time you clean your file system is when you start a node with "-reset". Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Jul 17 13:55:57 2005 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6HKtv3e031385 for ; Sun, 17 Jul 2005 13:55:57 -0700 Received: from mxsf01.cluster1.charter.net ([209.225.28.201]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with ESMTP id <0IJS00ABAIFEOO20@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Sun, 17 Jul 2005 14:02:03 -0700 (PDT) Received: from mxip03a.cluster1.charter.net (mxip03a.cluster1.charter.net [209.225.28.133]) by mxsf01.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id j6HL21Nm017323 for ; Sun, 17 Jul 2005 17:02:01 -0400 Received: from 66-215-4-155.pas-mres.charterpipeline.net (HELO lesliee502e195) (66.215.4.155) by mxip03a.cluster1.charter.net with ESMTP; Sun, 17 Jul 2005 17:02:02 -0400 Date: Sun, 17 Jul 2005 14:01:54 -0700 From: Leslie Cheung Subject: Re: bit vector To: cs551@merlot.usc.edu Message-id: <43vthu$121taqi@mxip03a.cluster1.charter.net> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWLEsLtZWHS4VM8Qy+brKRPukvHUQ== X-IronPort-AV: i="3.93,296,1115006400"; d="scan'208"; a="1142860626:sNHT28432586" Someone wrote: >Thanks for your detail explanation. > >I also have another question. > >When we compute bit vector of a file, there can be some keywords. >For example, there are 3 keywords, 'category', 'url', and 'title. >To compute bit vector, we get the first bit vector from 'category' and get >the second one from 'url, and so on. >From these bit vectors, we add (logically OR) each bit vector. >However, if a digit of a bit vector collides with a digit of the another bit >vector, let say 351(87*4+3) and 350(87*4+2), >will the digit be 12 (1100 = 1000 + 0100) by logically OR? Correct. >If so, how can we know that 351(87*4+3) is in the bit vector? When you want to see if bit x is set, you create a bit vector, and set only bit x. Then you AND this bit vector with only bit x set with your bit vector. If you see bit x is set in the resulting vector, yes, bit x is set. We usually say one key collides with another key if both keys want to set the same bit. It's ok to have this. So even when the bit you are interested is set, the keyword you are interested may not be present, and you still need to search the keyword list. The whole point of bit vector is to reduce this kind of search. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Jul 17 13:25:34 2005 Received: from msg-mx5.usc.edu (msg-mx5.usc.edu [128.125.137.10]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6HKPY3e029991 for ; Sun, 17 Jul 2005 13:25:34 -0700 Received: from mxsf32.cluster1.charter.net ([209.225.28.156]) by msg-mx5.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with ESMTP id <0IJS008CTH0R0320@msg-mx5.usc.edu> for cs551@merlot.usc.edu; Sun, 17 Jul 2005 13:31:40 -0700 (PDT) Received: from mxip16a.cluster1.charter.net (mxip16a.cluster1.charter.net [209.225.28.146]) by mxsf32.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id j6HKVc7F008451 for ; Sun, 17 Jul 2005 16:31:38 -0400 Received: from 66-215-4-155.pas-mres.charterpipeline.net (HELO lesliee502e195) (66.215.4.155) by mxip16a.cluster1.charter.net with ESMTP; Sun, 17 Jul 2005 16:31:38 -0400 Date: Sun, 17 Jul 2005 13:31:27 -0700 From: Leslie Cheung Subject: Re: reading binary files To: cs551@merlot.usc.edu Message-id: <44038l$17e89pf@mxip16a.cluster1.charter.net> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWLDoHUlzr/JNqLSBG3VDa6J3G/fg== X-IronPort-AV: i="3.93,296,1115006400"; d="scan'208"; a="1323575087:sNHT15231064" Someone wrote: >I'm having trouble when reading large binary files (like .mp3's). >The following code is what I'm doing to calculate file size and also >calculate SHA1 hash for the file. >fgetc is returning EOF well before the end of the file. > >-------------------- >char c1 = '\0'; >fp = fopen(filename, "rb"); > >for (i = 0; ( (c1 = fgetc(fp)) != EOF); i++) >{ > SHA1_Update... >} >--------------------- > >Is there some other method I should use to iterate over a binary file? >I'm stuck. You might want to use "fstat" (man -s 2 fstat) to get the size of the file. I believe this function read the i-node (metadata) of the file. I am not sure why fgetc returns EOF well before the end of file, but if you know the size of the file without opening it, I think that would help? Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Jul 17 13:14:49 2005 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6HKEn3e029352 for ; Sun, 17 Jul 2005 13:14:49 -0700 Received: from mxsf33.cluster1.charter.net ([209.225.28.158]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with ESMTP id <0IJS003XUGIV1300@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sun, 17 Jul 2005 13:20:55 -0700 (PDT) Received: from mxip20a.cluster1.charter.net (mxip20a.cluster1.charter.net [209.225.28.150]) by mxsf33.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id j6HKKsUe008416 for ; Sun, 17 Jul 2005 16:20:54 -0400 Received: from 66-215-4-155.pas-mres.charterpipeline.net (HELO lesliee502e195) (66.215.4.155) by mxip20a.cluster1.charter.net with ESMTP; Sun, 17 Jul 2005 16:20:53 -0400 Date: Sun, 17 Jul 2005 13:20:46 -0700 From: Leslie Cheung Subject: Re: bit vector To: cs551@merlot.usc.edu Message-id: <4404j6$14nt2be@mxip20a.cluster1.charter.net> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWLDQPK1B4Un8nTRrmGtbG2jKvxXg== X-IronPort-AV: i="3.93,296,1115006400"; d="scan'208"; a="1233029486:sNHT27364870" Someone wrote: >The bit vector is 1024-bit. >I don't know why the bit-vector is 256 digit length. >Also, why do you express 757 as 189*4 + 1 in the spec example? >Can you explain more about bit vector? We represent a 1024-bit long bit vector as hex digits, so each hex digit represent 4 bits in the vector. That's why it is 256 in length. Let me give another example of bit vector. Assume that our bit vector is 16 bit long, and it contains all 0. We wish to turn on bit x (= 4 * y + z). Let's assume x = 13, so y = 3 and z = 1. So if we use binary number, this bit vector looks something like 0010 0000 0000 0000 If we represent it using hex digits, it looks like 2000 We first look at the hex digit we want to manipulate, and we should turn on bit z in hex digit y+1 (bit 1 in hex digit 4 in this case), so we have "2". In the hex format of the vector, we have y 0's after the hex digit we want to manipulate. In our case, y = 3, so we have "000". Let's go back to our 1024-bit case, and let's say we wish to turn on bit 757 (= 4*189 + 1). Assume we have all 0 in the bit vector initially. So, we should turn on bit 1 in hex digit 190, so we have "2". Then we insert 189 0's after hex digit 190. So the resulting bit vector is (0^66)2(0^189) where 0^n means n 0's in hex. If you want to turn on multiple bits, all you have to do is to repeat the procedure described above, and OR all the vectors. I hope this helps. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Jul 16 21:12:00 2005 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6H4C03e006028 for ; Sat, 16 Jul 2005 21:12:00 -0700 Received: from mxsf21.cluster1.charter.net ([209.225.28.221]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-2.07 (built May 25 2005)) with ESMTP id <0IJR00LAK7Y4N420@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Sat, 16 Jul 2005 21:18:04 -0700 (PDT) Received: from mxip15a.cluster1.charter.net (mxip15a.cluster1.charter.net [209.225.28.145]) by mxsf21.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id j6H4I3b9027072 for ; Sun, 17 Jul 2005 00:18:03 -0400 Received: from 66-215-4-155.pas-mres.charterpipeline.net (HELO lesliee502e195) (66.215.4.155) by mxip15a.cluster1.charter.net with ESMTP; Sun, 17 Jul 2005 00:18:03 -0400 Date: Sat, 16 Jul 2005 21:17:58 -0700 From: Leslie Cheung Subject: Re: Nonce To: cs551@merlot.usc.edu Message-id: <44039q$15s6csh@mxip15a.cluster1.charter.net> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWKhoNQr5TM1yR6TsSX3cke9kYv1w== X-IronPort-AV: i="3.93,295,1115006400"; d="scan'208"; a="1271083921:sNHT14827844" Someone wrote: >Should we input the file name into SHA1() to get the Nonce value? No, it should be something random. You can either pass in a random number to SHA1, or generate a random 20-byte thing (and not calling SHA1). You can think of a Nonce as an identifier of a file at a specific instance. For example, if a node stores a file "helloworld.txt" at time T=1, then when this node stores the same file "helloworld.txt" at time T=5, this new file should have a different nonce. >When we put Metadata into a message does the string "[metadata]" go in there too, >or is this string only present in the .meta file on disk? The string "[metadata]" should go in both the message and the .meta file. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Mon Jul 11 15:28:48 2005 Received: from msg-mx0.usc.edu (msg-mx0.usc.edu [128.125.137.5]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6BMSm3e008546 for ; Mon, 11 Jul 2005 15:28:48 -0700 Received: from usc.edu ([128.125.137.12]) by msg-mx0.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with ESMTP id <0IJH00KXRIPSHE70@msg-mx0.usc.edu> for cs551@merlot.usc.edu; Mon, 11 Jul 2005 15:34:40 -0700 (PDT) Received: from [128.125.137.2] (Forwarded-For: [128.125.3.83]) by msg-store1.usc.edu (mshttpd); Mon, 11 Jul 2005 15:34:40 -0700 Date: Mon, 11 Jul 2005 15:34:40 -0700 From: leslie cheung Subject: office hour, 7/13 To: cs551@merlot.usc.edu Message-id: MIME-version: 1.0 X-Mailer: Sun Java(tm) System Messenger Express 6.1 HotFix 0.08 (built Dec 8 2004) Content-type: text/plain; charset=us-ascii Content-language: en Content-transfer-encoding: 7BIT Content-disposition: inline X-Accept-Language: en Priority: normal Hi all, I'll have to move my office hour on Wednesday 7/13 to next Monday (7/18). So on next monday I'll have office hour from 3pm - 5pm. If you want to talk to me to get started on final project part 2, please send me an email and we can set up something on Friday (7/15). Sorry for the inconvenience. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Tue Jul 5 21:08:41 2005 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j6648fja020103 for ; Tue, 5 Jul 2005 21:08:41 -0700 Received: from smtp101.sbc.mail.mud.yahoo.com ([68.142.198.200]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IJ600APRUFVEL30@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Tue, 05 Jul 2005 21:14:20 -0700 (PDT) Received: (qmail 98709 invoked from network); Wed, 06 Jul 2005 04:14:19 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@69.108.108.72 with login) by smtp101.sbc.mail.mud.yahoo.com with SMTP; Wed, 06 Jul 2005 04:14:18 +0000 Date: Tue, 05 Jul 2005 21:14:08 -0700 From: Leslie Cheung Subject: documentation of Nam trace To: cs551@merlot.usc.edu Message-id: <0IJ600APSUFVEL30@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcWB4SexNcgnyXoQSAWgcUNpIcodxw== Some of you have asked me where you can find documentation of NAM trace format. The sample Nam trace given in the spec, "status.out", is pretty self-explanatory; I believe you can understand the format by changing that sample trace. If you want a more formal documentation, you can find that in ns/nam web site. http://www.isi.edu/nsnam/ns/doc/index.html In particular, Section 9 (subsection 43.1) has the information. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Jul 1 13:10:37 2005 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j61KAbja008859 for ; Fri, 1 Jul 2005 13:10:37 -0700 Received: from smtp102.sbc.mail.re2.yahoo.com ([68.142.229.103]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IIY00FPWTMTFX00@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Fri, 01 Jul 2005 13:16:06 -0700 (PDT) Received: (qmail 87552 invoked from network); Fri, 01 Jul 2005 20:16:05 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@69.108.108.72 with login) by smtp102.sbc.mail.re2.yahoo.com with SMTP; Fri, 01 Jul 2005 20:16:05 +0000 Date: Fri, 01 Jul 2005 13:16:00 -0700 From: Leslie Cheung Subject: Re: UOID To: cs551@merlot.usc.edu Message-id: <0IIY00FPXTMTFX00@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcV+ebK3NIZ9aR4OQ9KK61TLgXw0bw== Someone wrote... >I was wondering if the UOID needs to be different for every Message or for >every "Type" of message from a given node. Every time you generate a message, the UOID should be different. If you forward or flood a message, you should keep the old UOID instead of generating a new one. >Is it ok to send the same UOID for say every "Hello Message" from a given >node... It should be different. For example, if A sends HELLO to B and C, the UOID of the HELLO sent to B should be different than that to C. >If it needs to be diff... what should be the input to the getUOID() >function? The "seq_no" will do the job. Let's look at the "str_buf" that is passed to SHA1. Assume that we are only generating UOID for messages. The first time you call GetUOID, str_buf should be... nunki.usc.edu:15000_msg_1 The second time you call it, str_buf should be nunki.usc.edu:15000_msg_2 and the result UOID should be different than the first UOID. "seq_no" is a static variable, so its value will stay when the function return. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Wed Jun 15 18:42:19 2005 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j5G1gJja017548 for ; Wed, 15 Jun 2005 18:42:19 -0700 Received: from smtp828.mail.sc5.yahoo.com ([66.163.171.15]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0II5002OEMAN5Y50@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Wed, 15 Jun 2005 18:47:11 -0700 (PDT) Received: (qmail 53836 invoked from network); Thu, 16 Jun 2005 01:47:11 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@69.227.188.95 with login) by smtp828.mail.sc5.yahoo.com with SMTP; Thu, 16 Jun 2005 01:47:10 +0000 Date: Wed, 15 Jun 2005 18:47:07 -0700 From: Leslie Cheung Subject: RE: status response message In-reply-to: To: cs551@merlot.usc.edu Message-id: <0II5002OFMAN5Y50@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Thread-index: AcVyDz/GQ20euYF2Qa2nS3xboqUVAgAAwB2g Someone wrote: >For the status response message, should a node send the status of all the >nodes that is currently connected to...or just the nodes from the >init_neighbor_list that it initiated a connection with when it came up. It should send status of ALL nodes it is connecting to. >The reason i'm asking is there are chances of link duplication when all >the status response messages get back to the requesting node. > >For example, if node A is the requesting node connected to node B and C, >and this is a fully connected network, then node B will respond with node >C and node A being its neighbors. Node C will respond with node A and node >B being its neighbors. Now, when node A is creating the NAM input file >with all these status response messages, it will input the link from node >B to node C twice, since both B and C responded with each other being >neighbors. If you implement the protocol correctly, yes, you should get duplicate links. Your code should be smart enough to eliminate this duplication. In fact, if you don't get duplicate links, it might be a signal that there are bugs in your code, or it could be that the TTL is not large enough. >However, an easier solution would be if node B initiated the connection >with node C, then node B will consider node C its neighbor, but node C >will not have node B as its neighbor (even though it's connected to it). >Therefore, when it's time to send status response messages, node B will >report C as being its neighbor and that's all. Therefore, only one link >between B and C will be input into the NAM file. When you say "node B will consider node C its neighbor, but node C will not have node B as its neighbor ", I am assuming you are saying just in the context of your proposed easier solution. According to the spec, if B is a neighbor of C, C has to be a neighbor of B. >Is this implementation of the status response message allowed? Or do we >still need to include all nodes that are connected to a node, regardless >of who initiated the connection? I would have to say no, and please do not implement that way. Please follow the spec. My understanding is that your node should report all connected neighbors when it receives "status neighbor" messages, regardless of who initiated the connection. Thanks, Leslie Return-Path: lccheung@usc.edu Delivery-Date: Wed Jun 15 15:30:17 2005 Received: from msg-mx4.usc.edu (msg-mx4.usc.edu [128.125.137.9]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j5FMUHja008731 for ; Wed, 15 Jun 2005 15:30:17 -0700 Received: from usc.edu ([128.125.137.12]) by msg-mx4.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with ESMTP id <0II500GSIDELL480@msg-mx4.usc.edu> for cs551@merlot.usc.edu; Wed, 15 Jun 2005 15:35:09 -0700 (PDT) Received: from [128.125.137.3] (Forwarded-For: [128.125.3.83]) by msg-store1.usc.edu (mshttpd); Wed, 15 Jun 2005 15:35:09 -0700 Date: Wed, 15 Jun 2005 15:35:09 -0700 From: leslie cheung Subject: office hour, 6/20 To: cs551@merlot.usc.edu Message-id: MIME-version: 1.0 X-Mailer: Sun Java(tm) System Messenger Express 6.1 HotFix 0.08 (built Dec 8 2004) Content-type: text/plain; charset=us-ascii Content-language: en Content-transfer-encoding: 7BIT Content-disposition: inline X-Accept-Language: en Priority: normal Hi all, I am going to cancel my office hour next Monday (6/20). I'll hold my office hour next Wed (6/22) from 3pm - 5pm. If you want to talk to me, but cannot come to my office hour next Wed, please send me an email so we can set up an appointment. Thanks, Leslie Return-Path: lccheung@usc.edu Delivery-Date: Thu Jun 9 14:39:48 2005 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j59Ldmja008371 for ; Thu, 9 Jun 2005 14:39:48 -0700 Received: from smtp800.mail.sc5.yahoo.com ([66.163.168.179]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IHU00FC17210F10@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Thu, 09 Jun 2005 14:44:26 -0700 (PDT) Received: (qmail 11047 invoked from network); Thu, 09 Jun 2005 21:44:25 +0000 Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp800.mail.sc5.yahoo.com with SMTP; Thu, 09 Jun 2005 21:44:25 +0000 Date: Thu, 09 Jun 2005 14:46:24 -0700 From: Leslie Cheung Subject: verifying your simulation To: cs551@merlot.usc.edu Message-id: <0IHU00FC37220F10@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Thread-index: AcVtPK5++pZsiDMMT+G1RrfGbXaJ/g== Hi, A lot of people has asked how we know if the simulation is doing the "right" thing. Here is one way to check. First, set "size" (size of the queue) to be a large value. We want to avoid dropping. In fact, dropping customer complicates the math :) If you see the dropping probability is not close to 0, set "size" to be a larger value. Then, make your simulation a M/M/1 simulation. Again, the math for M/M/2 is harder. You also want to make sure that your system is "stable". "Stable" here means that the arrival process should be slower than the service process, so that the queue doesn't get blow up. You can do so by setting lambda < mu. Now, here is the math. Define rho = lambda/mu. "average inter-arrival time" should be close to "1/lambda". "average service time" should be close to "1/mu". "average number of customers in Q1" should be close to "(rho^2) / (1 - rho)". "average number of customers at S1" should be close to "rho". "average time spent in system" should be close to "1/(mu*(1 - rho))". If your simulation is not close to these results, possible reasons are 1) you didn't run the simulation long enough, 2) there are dropped customer which affect the math, 3) bugs, or 4) you are just not lucky enough (so it's not your fault). Try using different value for "-seed" so you can eliminate #4. Leslie Return-Path: lccheung@nunki.usc.edu Delivery-Date: Mon Jun 6 17:10:29 2005 Received: from msg-mx0.usc.edu (msg-mx0.usc.edu [128.125.137.5]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j570ATja004830 for ; Mon, 6 Jun 2005 17:10:29 -0700 Received: from nunki.usc.edu ([128.125.5.168]) by msg-mx0.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with ESMTP id <0IHO0014OU0ZPRG0@msg-mx0.usc.edu> for cs551@merlot.usc.edu; Mon, 06 Jun 2005 17:14:59 -0700 (PDT) Date: Mon, 06 Jun 2005 17:14:59 -0700 (PDT) From: lccheung Subject: clarifications for questions during office hour To: cs551@merlot.usc.edu Message-id: MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Content-transfer-encoding: 7BIT Hi all, Some of you came to my office hour, and asked me to clarify something. I said I have to read the spec again carefully before answering with confident. And here they are. 1) If a user presses , we should stop the arrival process. But should we process the customers already in the queue? > Yes, you should process all customers in the queue before exiting. In the spec it says "let your system finish serving all the customers in the usual way" (This overrides what I said during my office hour). 2) Inter-arrival time and service time are in milliseconds. Should the statistics also be in milliseconds? Or should it be in seconds? > It should be in seconds. 3) In the sample output, the inter-arrival time is a double. However, in the given "GetInterval" function, the return value is an integer. So should the return value of "GetInterval" be a double instead of an integer? > The return value of "GetInterval" is an integer. However, what you print out in your program should be what you *measure*. For example, in the sample output, let's say the inter-arrival time for c1 is 312ms. It may take 0.112ms to take care of bookkeeping. So, in this example, although the generated inter-arrival time is 312ms, you should print 312.112ms in your output. And you should use the value "312.112" in calculating the statistics. I also want to remind everyone that you should report what you measure, not what you calculate. For example, some of you may know how to calculate "average time spent in system" (by Little's Law). However, you *cannot* use this result in your output. You have to report what you measure using "gettimeofday". Thanks, Leslie Return-Path: lccheung@usc.edu Delivery-Date: Mon Jun 6 00:11:34 2005 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j567BYja021488 for ; Mon, 6 Jun 2005 00:11:34 -0700 Received: from smtp816.mail.sc5.yahoo.com ([66.163.170.2]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IHN00JY6IUSF180@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Mon, 06 Jun 2005 00:16:04 -0700 (PDT) Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp816.mail.sc5.yahoo.com with SMTP; Mon, 06 Jun 2005 07:16:03 +0000 Date: Mon, 06 Jun 2005 00:15:59 -0700 From: Leslie Cheung Subject: RE: select function To: cs551@merlot.usc.edu Message-id: <0IHN00JY7IUSF180@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcVqZ5atow6+S9CKSwy7rltL//agaw== Someone wrote: >Where can I get good reference on select function? >What is the correct parameter to look at man page about this function? >for example man -s 2 select or something... One good reference for the "select" function is the UNIX network programming book listed as a recommended textbook in the course description. If you don't have the book or want to take a look to the man page of "select" on nunki, here is the command. man -s 3c select Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Jun 4 01:05:26 2005 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j5485Qja005309 for ; Sat, 4 Jun 2005 01:05:26 -0700 Received: from smtp813.mail.sc5.yahoo.com ([66.163.170.83]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IHJ00A47W0AVCC0@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Sat, 04 Jun 2005 01:09:46 -0700 (PDT) Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp813.mail.sc5.yahoo.com with SMTP; Sat, 04 Jun 2005 08:09:46 +0000 Date: Sat, 04 Jun 2005 01:09:42 -0700 From: Leslie Cheung Subject: RE: Thread function argument To: cs551@merlot.usc.edu Message-id: <0IHJ00A48W0AVCC0@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcVo3MMAg7SvbCA3Rfe3bFdDs1ZWDQ== >I have two questions. > >There is a example on the thread's identfication number of thread >using 4th argument of pthread_create() in the page 80 of >"pthreads programming" > >However, it has incompatible type problem of the definition of pthread_create(). > >Is there any other way to identify thread number not addreass? > You can get around the problem by 1) defining the function that the thread run to take an argument with type (void *), and 2) casting the 4th argument in pthread_create to type (void *). >This is another problem. > >Is it possible for threads to be created without following the order of calling >of pthread_create() ? > >What I mean is that, Although I create two threads 1 and 2 sequentially, >is it possible for the 2nd thread to be created first? So let's say we create two threads as follows. pthread_t t1, t2; pthread_create(&t1, NULL, do_something, NULL); pthread_create(&t2, NULL, do_something_else, NULL); Are you asking if we can create t2 first, then create t1? I would say yes. Threads are not executed in the order they are created; the order they execute is really up to the OS scheduler. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Jun 3 23:02:30 2005 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j5462Uja032060 for ; Fri, 3 Jun 2005 23:02:30 -0700 Received: from smtp810.mail.sc5.yahoo.com ([66.163.170.80]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IHJ00ANJQBIVC60@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Fri, 03 Jun 2005 23:06:55 -0700 (PDT) Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp810.mail.sc5.yahoo.com with SMTP; Sat, 04 Jun 2005 06:06:54 +0000 Date: Fri, 03 Jun 2005 23:06:50 -0700 From: Leslie Cheung Subject: RE: Pthreads not working? In-reply-to: To: cs551@merlot.usc.edu Message-id: <0IHJ00ANKQBJVC60@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcVotdRLEM4MMA5WQX64akjDx41JWwAFPOIg >I am running my code on Nunki - and seems threads are not >working........ >I also tried a sample example from "Pthreads Programming" >(CODE Attached) and still it did not work. > >Now the expected output is something like: > doing another > doing one thing > doing another > doing one thing > doing another > doing one thing > doing another > doing one thing > wrap up: one thing 4, another 4, total 8 > >but the output that I get is: > wrap up: one thing 0, another 0, total 0 > >Please look into it.... First, please do not send me source code. I don't read them. If you want to show me something, please come to my office hour. If you are following the example in the Pthread book, and can't make it work, my guess is that you didn't link the pthread library. Please read the man page of pthread_create on nunki to see what library you need to link. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Jun 3 15:19:09 2005 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j53MJ9ja010429 for ; Fri, 3 Jun 2005 15:19:09 -0700 Received: from smtp813.mail.sc5.yahoo.com ([66.163.170.83]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IHJ003CE4V72M20@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Fri, 03 Jun 2005 15:23:32 -0700 (PDT) Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp813.mail.sc5.yahoo.com with SMTP; Fri, 03 Jun 2005 22:23:30 +0000 Date: Fri, 03 Jun 2005 15:23:27 -0700 From: Leslie Cheung Subject: RE: ExponentialInterval? In-reply-to: To: cs551@merlot.usc.edu Message-id: <0IHJ003CI4V82M20@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Thread-index: AcVodFTpekFCzbA0SdGouz6b8DPXSgAFMQfQ >A very silly question: What is ExponentialInterval fuction supposed to do? >- My idea is: >Map the input random number to the Poison Function and return this >mapping. This would be the interarrival / service time. You need to take the random number (dval), and map that to the PDF of a Poisson process with rate given by "rate". >If it is so.... I am not exactly sure how to do the mapping... if its OK can you >please put a general guideline.... Please refer to the last figure in the spec. You'll need "rate" to obtain F(x). "dval" represents a value on the y-axis. So given "dval" and "rate", you can map a value on the x-axis, which is the number you are supposed to return. You'll also need to make sure the return value has to be between 1 and 10000. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Mon May 30 12:55:08 2005 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j4UJt8ja024415 for ; Mon, 30 May 2005 12:55:08 -0700 Received: from smtp818.mail.sc5.yahoo.com ([66.163.170.4]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IHB009KQJIJV640@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Mon, 30 May 2005 12:59:12 -0700 (PDT) Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp818.mail.sc5.yahoo.com with SMTP; Mon, 30 May 2005 19:59:06 +0000 Date: Mon, 30 May 2005 12:59:02 -0700 From: Leslie Cheung Subject: nunki is working again To: cs551@merlot.usc.edu Message-id: <0IHB009KRJIJV640@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcVlUgZd1SUPmwgXQYCKHCkFG5lTsA== Hi all, It looks like nunki is working again. So, you guys can now work on the project. By the way, if you have not submitted anything yet, it's a good idea to try submitting something now to get you familiar with the bsubmit command. Leslie Return-Path: lccheung@nunki.usc.edu Delivery-Date: Sun May 29 21:33:27 2005 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j4U4XRja013792 for ; Sun, 29 May 2005 21:33:27 -0700 Received: from nunki.usc.edu ([128.125.5.168]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with ESMTP id <0IHA00MS9CURLZ40@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sun, 29 May 2005 21:37:39 -0700 (PDT) Date: Sun, 29 May 2005 21:37:39 -0700 (PDT) From: lccheung Subject: my avaliability tomorrow (5/30) To: cs551@merlot.usc.edu Message-id: MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Content-transfer-encoding: 7BIT Hi class, I will come to campus tomorrow in the afternoon. If you have any last minute questions or need help on debugging, please send me email. I will *not* hold office hour tomorrow, however. Thanks, Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat May 28 20:24:29 2005 Received: from msg-mx4.usc.edu (msg-mx4.usc.edu [128.125.137.9]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j4T3OTja030470 for ; Sat, 28 May 2005 20:24:29 -0700 Received: from smtp818.mail.sc5.yahoo.com ([66.163.170.4]) by msg-mx4.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IH800AUEEZRCZ20@msg-mx4.usc.edu> for cs551@merlot.usc.edu; Sat, 28 May 2005 20:28:40 -0700 (PDT) Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp818.mail.sc5.yahoo.com with SMTP; Sun, 29 May 2005 03:28:39 +0000 Date: Sat, 28 May 2005 20:28:35 -0700 From: Leslie Cheung Subject: character operation To: cs551@merlot.usc.edu Message-id: <0IH800AUFEZRCZ20@msg-mx4.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcVj/n8By03AIL8JRKOYLXOFouTNDg== Someone wrote: >Just want to confirm whether my assumption is correct or not. I don't >have to worry about network byte order for character data right? I only >have to concern number for the network byte order? The reason of having the byte order issues for integers is that we use multiple bytes to represent an integer. In the case of characters, we use 1 byte to represent a character. So there is no such issue for characters. >I already succeed in displaying filesize, the instruction and other >numeric type but I am having difficulty in character data type. >Everytime I called memcpy(data, &msg_buf[6], datalength), the >char* data wll only give me the first two character of the ip address. >Is this the right way to do it in term of copying character type data? First check if your server is sending the correct response. Start a debugger and examine the memory to see if the response makes sense. Also read the man page for "gethostbyname()" to see the format of the output. You cannot just "print" that output; you need to do something to convert the output from "gethostbyname()" to the format we get used to (e.g., "128.125.5.168"). Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri May 27 00:01:52 2005 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j4R71qja003649 for ; Fri, 27 May 2005 00:01:52 -0700 Received: from smtp835.mail.sc5.yahoo.com ([66.163.171.22]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IH40086IZPYRVD0@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Fri, 27 May 2005 00:05:58 -0700 (PDT) Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp835.mail.sc5.yahoo.com with SMTP; Fri, 27 May 2005 07:05:57 +0000 Date: Fri, 27 May 2005 00:05:54 -0700 From: Leslie Cheung Subject: RE: broken pipe and fork() To: cs551@merlot.usc.edu Message-id: <0IH40086JZPYRVD0@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcViioYH9k0q0+4eQ3yarwfpzWBJ6w== Someone wrote... >As I looked up in internet, the cause of broken pipe is when one of the >end close the connection so when the other end writes into the pipe or >network, it will encounter a broken pipe. I am so confused that yesterday >and the whole afternoon today my code was running fine but tonight I >have to restart my server couple of times because broken pipe occured >many times My server is still listening for the respond of the client when >this broken pipe problem occured. . >Any idea? I would check the return code for all network system calls to find where the problem could be. You can also try removing code that you have added recently to see if the new code are causing problems. You can also use the "signal" system call to handle SIGPIPE. Do "man -s 3c signal" for a man page for "signal". You can choose to ignore SIGPIPE, or write a signal handler to handle it (recommended). To ignore SIGPIPE, add this line. signal(SIGPIPE, SIG_IGN); If you choose to handle SIGPIPE, write a handler as follows. /* code starts here */ void sig_handler (int sig_no) { if (sig_no == SIGPIPE){ // we've got SIGPIPE, do something } else { //other signal is caught... do something } } /* code ends here */ Also add the following line to tell your program you want to handle SIGPIPE yourself.. signal(SIGPIPE, sig_handler); >One more question regarding fork(). > >When we call fork(), Is all the code below this function (inside the scope) >will be ignored by the mainthread? so the new thread is the one is going >to execute those codes. > >for example : >main() >{ >if(fork()==0){ >code1 >code2 >} >code3 >} > >code1 and code2 will be executed by new thread meanwhile code3 is >executed by mainthread. >Please verify.... You are correct. By the way, we will use pthreads in future projects. So if you are not familiar with pthreads, it's a good chance to learn using them. There is a chapter on the Stevens book on pthreads, and Bill has recommended a pthreads book (see the class web page). You can also find tutorials online. If you are using fork(), it's ok for this project. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Thu May 26 02:31:24 2005 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j4Q9VOja008511 for ; Thu, 26 May 2005 02:31:24 -0700 Received: from smtp808.mail.sc5.yahoo.com ([66.163.168.187]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IH300B59BZ3ZR10@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Thu, 26 May 2005 02:35:28 -0700 (PDT) Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp808.mail.sc5.yahoo.com with SMTP; Thu, 26 May 2005 09:35:27 +0000 Date: Thu, 26 May 2005 02:35:23 -0700 From: Leslie Cheung Subject: RE: weird error To: cs551@merlot.usc.edu Message-id: <0IH300B5ABZ3ZR10@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcVh1j1VC/W8WZIJT2WdsLATMnPnxg== Someone wrote: >1. nunki.usc.edu(78): gmake >g++ -c Server.cc >Server.cc: In function `int main(int, char**)': >Server.cc:88: error: invalid conversion from `int*' to `socklen_t*' >gmake: *** [Server.o] Error 1 > >my code snippet at line#87and 88 >len = sizeof(clientaddr); >conn = accept(socketdescriptor, (sockaddr *) &claddr, &len); > >somehow the &len is introducing problem but I already checked >everywhere and this is the correct way of doing it My guess is that you have defined "len" as type "int", rather than type "socklen_t". When you do all these system calls, make sure you pass the parameters EXACTLY as described in man pages. Be very careful. >2. I decided to uncomment the above problem and resuming my >programming but I encountered another weird error >nunki.usc.edu(80): gmake >g++ -c Server.cc >g++ -o server Server.o >Undefined first referenced > symbol in file >__xnet_socket Server.o >listen Server.o >__xnet_bind Server.o >ld: fatal: Symbol referencing errors. No output written to server >collect2: ld returned 1 exit status >gmake: *** [server] Error 1 This is a linker error. *LINKING* is different from *COMPILING*. If your program can compile, that just means you have convinced the compiler that all functions you call can be found in the given header files. BUT the linker has no idea where to grab some of these libraries. Read the man pages of the functions that the linker complains (in this case, "socket", "bind" and "listen"). You need to add -lnsl and -lsocket when you compile. Try g++ -c Server.cc g++ -o server Server.o -lnsl -lsocket Please do not send me any source code in the future. I am not going to read them. Leslie Return-Path: lccheung@usc.edu Delivery-Date: Thu May 26 00:43:01 2005 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.12.8/8.12.8) with ESMTP id j4Q7h1ja003502 for ; Thu, 26 May 2005 00:43:01 -0700 Received: from smtp806.mail.sc5.yahoo.com ([66.163.168.185]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-2.02 (built Mar 22 2005)) with SMTP id <0IH300BPH6YGWCA0@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Thu, 26 May 2005 00:47:05 -0700 (PDT) Received: from unknown (HELO lesliee502e195) (leslieck@69.108.110.53 with login) by smtp806.mail.sc5.yahoo.com with SMTP; Thu, 26 May 2005 07:47:04 +0000 Date: Thu, 26 May 2005 00:47:00 -0700 From: Leslie Cheung Subject: RE: arguments To: cs551@merlot.usc.edu Message-id: <0IH300BPI6YHWCA0@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcVhxxk3j4mh0aYMRXG5zJwD8CvhXQ== Someone wrote... > Can we use -p to set the port? Because if you don't have - something, it is harder > to know whether the user is trying to specify the port or not. This is for simplicity > and I believe the point of the project is not at this argument thing. I assume you are talking about the arguments for the server. Even if we don't have the "-p" argument, I believe we are still able to figure out which number corresponds to "seconds", and which number corresponds to "port". So I think that is not needed. Leslie