https://secure.csse.uwa.edu.au/run/help3002?p=np&rss=y
help3002 - Pseudo Code Marking Guidehelp3002 - Pseudo Code Marking Guidehelp3002https://blogs.law.harvard.edu/tech/rssThe University of Western AustraliaMon, 13 Jul 2020 15:58:50 +0800Mon, 13 Jul 2020 15:58:50 +0800Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=755
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=755Mon, 08 Jun 2020 18:39:26 +0800ANONYMOUSAh, I understand now. Thanks for clarifying Chris :)
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=754
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=754Mon, 08 Jun 2020 18:36:44 +0800"Christopher McDonald" <chris.mcdonald@uwa.edu.au>ANONYMOUS wrote:
There are many types of simulation - they do not all just involve time slots and packet collisions.
Although you won't be asked to produce any answers using the cnet code/API, that was a form of simulation that didn't require you to set
up time slots, etc.
Their answer providing just pseudo-code, without providing any additional written text, would be the correct/sufficient *form* of answer,
but it was not a full answer.
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=753
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=753Mon, 08 Jun 2020 18:32:05 +0800ANONYMOUSHi Chris,
I was referring to the word "simulation" in the question. If it is a simulation, then we would need to set up timeslots and
iterate through each one so that we can simulate collisions/success.
If we're just asked to write pseudocode for an algorithm e.g. CSMA/CD 1-persistent, then the code that the OP wrote would be
the answer.
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=752
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=752Mon, 08 Jun 2020 18:16:23 +0800"Christopher McDonald" <chris.mcdonald@uwa.edu.au>ANONYMOUS wrote:
Hi,
It depends how the question is worded. If it just asks for pseudo-code, that's all it's asking for, and you're
answering the question through the use of well chosen identifiers, variables/data structures, and control flow. And
you can further support your answer with comments.
If the question asks "With the aid of some pseudo-code, explain how....."
then you should provide both some pseudo-code and written text to explain it and the concept being 'implemented'.
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=751
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=751Mon, 08 Jun 2020 17:25:58 +0800ANONYMOUSHi Chris,
Just to clarify, if a question in the exam asks us to write pseudo code for a simulation of an
algorithm, we shouldn't just provide the pseudo code for the algorithm itself right? Because that is
what I think the OP of this post wrote. Whereas the pseudocode for the simulation would look something
more like the 3rd post in this thread, correct?
The question they were answering relates to 2017 Q1B:
"Develop some pseudo-code, with a syntax similar to either Java or C, that simulates the behaviour of
the 1-persistent CSMA/CD protocol over 10Mbps Ethernet.
The simulation should support N identical nodes, each wishing to transmit a frame to other nodes at
random intervals. Assume that the Ethernetâ€™s slot-time is 52 microseconds, and that collision detection
and resolution takes exactly one slot-time."
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=749
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=749Mon, 08 Jun 2020 16:42:42 +0800ANONYMOUS
Thanks Chris
That does help. I was going to add the code to construct the nodes but I though that was trivial.
I'll add that in my answers if a similar question is in the exam
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=747
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=747Mon, 08 Jun 2020 16:34:03 +0800"Christopher McDonald" <chris.mcdonald@uwa.edu.au>ANONYMOUS wrote:
About 7or8 / 10 on the generous scale.
Important things to consider/add:
- it's based on Ethernet, so you need binary-exponential backoff, not just a random backoff.
- nodes can detect collisions that even they are not involved in (they did not cause), and that
affects their determination of how long to backoff for.
- (trivial) don't forget to start/instantiate each of your Node()s.
Hope that helps.
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=744
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=744Mon, 08 Jun 2020 10:49:54 +0800ANONYMOUSHi there,
Yes, but in the python pseudo code I posted above, that was just a simulation and doesn't have any
relation to the cnet framework.
Hopefully Chris clarifies soon!
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=743
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=743Mon, 08 Jun 2020 10:46:00 +0800ANONYMOUSANONYMOUS wrote:
Hi there,
I thought that initially but at the end of the question it says 'You are not being asked to
develop a protocol using the cnet framework'
It is true though that it'll be a bit more challenging if it was
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=742
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=742Mon, 08 Jun 2020 10:41:53 +0800ANONYMOUSIgnore the first comment # set each node to true as all nodes want to transmit
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=741
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=741Mon, 08 Jun 2020 10:39:22 +0800ANONYMOUSHi Chris,
Would something like this be correct for 2017 Q1b?
def csma_one_persistent(nNode, nSlotTime, probNew):
# set each node to true as all nodes want to transmit
transmit = [False] * nNode # will produce an array of False for the num of nodes
# for each time slot
For slot in range(nSlotTime):
nAttempting = 0 # set num attempting to transmit to zero
successfulNode = -1 # set -1 to indicate that no node was successful yet
# determine what nodes need to transmit or re-transmit during this time slot
For node in range(nNodes):
# does the node have a new transmission?
If not transmitting[node] and rand(0,1) < probNew:
transmitting[n] = true # the node is attempting to transmit
successfulNode = n
nAttempting = nAttempting + 1
# does the node need to transmit (i.e. it waited for the next timeslot)?
Elif transmitting[n]:
successfulNode = n
nAttempting = nAttempting + 1
If nAttempting == 1: # if I am the first node transmitting in this timeslot, then I
have succeeded
nSuccess = nSuccess + 1
transmitting[successfulNode] = false # set the node back to not needing to
transmit (false)
# All subsequent nodes will hear that there is already a transmission and NOT
transmit, but wait for the next timeslot to transmit (i.e. it is one-persistent)
nNodes = 10 # number of nodes wishing to transmit (arbitrarily assigned for this example)
nSlotTime= 10000 # num of slots times for the simulation(arbitrarily assigned for this
example). Each slot time represents 52 miliseconds
probNew = 0.5 # probablility that a new message is to be sent
csma_one_persistent(nNodes, nSlotTime, probNew)
Re: Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=740
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=740Mon, 08 Jun 2020 10:08:38 +0800ANONYMOUSHi there,
From reading question 1b from 2017, it looks like Chris is asking us to create pseudo-code
for a simulation (emphasis on simulation) and not pseudo-code for how the algorithm works
(which is what you've written).
If that is right, then it'll be slightly more challenging and would look something like
the SlottedAloha.c code that Chris wrote:
https://teaching.csse.uwa.edu.au/units/CITS3002/labs/lab4/slottedaloha-soln.c
Pseudo Code Marking Guide
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=730
https://secure.csse.uwa.edu.au/run/help3002?p=np&a=730Sun, 07 Jun 2020 23:40:44 +0800ANONYMOUSBelow is my answer for 2017 exam, question 1b) that I did under exam conditions
Class â€“Node
{
SLOT_TIME = 52 // microseconds
Messages_sent = 0
Messages_received = 0
Constructor - Node ()
{
main_loop()
}
Function - main_loop()
{
While (True)
{
// Ready to send returns a boolean
If (Ready_To_Send())
{
While (True)
{
Send_Message()
Messages_sent++
// Listen for a collision for 1 slot time
// Returns true if collision, else false
If (Listen_for_collision(SLOT_TIME))
{
// Determine random wait time
Wait_time = random() * SLOT_TIME
Sleep(wait_time)
}
Else
{
Break
}
}
Else if (Messaged_Received())
{
Messages_received++
}
}
}
}
To determine the maximum utilisation of the channel, the total number of messages
received of all the nodes should be divided by the total number of sent messages of
all the nodes
I was just wondering, what mark would an answer like this get and what improvements
can be made?