From 62c93337653f2e86cce5f2c89f49af01085af50b Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Mon, 4 Mar 2019 22:23:46 -0600 Subject: [PATCH] ... --- .editorconfig | 6 ++++++ content/pages/_index.md | 1 + content/pages/about.md | 1 - content/pages/analogies.md | 20 ++++++++++++++++++++ content/pages/setup.md | 1 - 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .editorconfig create mode 100644 content/pages/analogies.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..896435b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*] +end_of_file = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/content/pages/_index.md b/content/pages/_index.md index f9ea25a..fe14926 100644 --- a/content/pages/_index.md +++ b/content/pages/_index.md @@ -1,4 +1,5 @@ +++ title = "all pages" template = "listing.html" +page_template = "post.html" +++ diff --git a/content/pages/about.md b/content/pages/about.md index 4c45580..11d7c33 100644 --- a/content/pages/about.md +++ b/content/pages/about.md @@ -1,6 +1,5 @@ +++ title = "about me" -template = "post.html" +++ Hi there! I'm a Computer Science student at the University of Minnesota, and I've got a wide variety of interests under this field. I've been doing web development for a long time and now I'm looking into security, programming language development, and software development! diff --git a/content/pages/analogies.md b/content/pages/analogies.md new file mode 100644 index 0000000..dc7455e --- /dev/null +++ b/content/pages/analogies.md @@ -0,0 +1,20 @@ ++++ +title = "interesting cs analogies" ++++ + +stupid analogies i think of in my free time + +## socket server + multiple clients analogy + +If you think about it, a server waiting for clients is kind of like the host at the front of a restaurant leading guests to tables. They don't actually take orders or serve food, they just stand at the front and wait for new guests to arrive. Then there's another waiter that's specifically assigned to take that table's orders. + +When a server binds to, for example, `localhost:3000`, what the server really gets is a file descriptor; this is what's meant by: + +```c +int socket(int domain, int type, int protocol); +int bind(int socket, const struct sockaddr *address, socklen_t address_len); +``` + +The `listen` library call then marks this socket as one that's open for connections, similar to marking the restaurant staff as a host rather than a waiter. + +According to the manpage for `accept`, when a connection-mode socket accepts a connection, it'll "extract the first connection on the queue of pending connections, create a new socket with the same socket type protocol and address family as the specified socket, and allocate a new file descriptor for that socket." This new socket would be the waiter who actually takes your orders. diff --git a/content/pages/setup.md b/content/pages/setup.md index 1179a07..4004e7a 100644 --- a/content/pages/setup.md +++ b/content/pages/setup.md @@ -1,6 +1,5 @@ +++ title = "my setup" -template = "post.html" +++ ## desktop