-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
I'm running rumprun on qemu (hw target) using e1000 (wm0, configured with DHCP) with the following code snippet:
// A: sched_yield();
char buf[64];
pkt_sent = 0;
while (pkt_sent < 3) {
sprintf(buf, "pkt %zu\n", pkt_sent);
if (sendto(fd, buf, strlen(buf)+1, 0, dst, sizeof(struct sockaddr_in)) >= 0)
pkt_sent++;
else {
printf("errno %d: %s\n", errno, strerror(errno));
exit(1);
}
// B: sched_yield();
}
// C: sched_yield();On the receiver (listening on a tap device) I get the following output:
pkt 2
With the same code on Linux I see the following 3 messages on the receiver socket:
pkt 0
pkt 1
pkt 2
With uncommenting sched_yield calls I see the following outputs:
Unikernel (uncomment line A):
pkt 2
Unikernel (uncomment line B):
pkt 1
pkt 2
Unikernel (uncomment line C):
pkt 2
Unikernel (uncomment line A,B,C):
pkt 1
pkt 2
I have the following questions to help my understanding of the cooperative scheduling model:
- How do I send pkt 0 with the unikernel?
- Is there a better way to send multiple packets without inserting calls to sched_yield (e.g., will a proper poll/select loop etc. take care of this?)
- Is it a bug that sendto() does not return with an error, even though the message for pkt 0 was never sent?
Metadata
Metadata
Assignees
Labels
No labels