Skip to main content

Posts

Throughput, Latency, and Pipelines: Diagnosis Of A Fallacy

Source here . Latency is the time it takes for a job to complete from start to finish -- for example, if we're downloading a file from a server, we might define the latency of the download as the amount of time it takes from the initial request for the file to the time the last byte is received. Throughput is a measure of how much can be completed in a given time.  Following the same example, how many files could we download in an hour? What is the relationship between latency and throughput?   It make take, again, 1 hour to download a file.  Notice already that we have a relationship between some amount of work that can be completed and time -- if the file is, say, 2 GB, it takes 1 hour to download 2 GB in our example.  What we really want to do here is generalize: how long does it take to download 10 GB?  How many GB can we download in ten hours or one minute?  Generalizing over time, we derive latency; generalizing over work completed, we derive the...
Recent posts

Nailing Down The Meaning Of "This" In JavaScript

Sense-certainty itself has thus to be asked: What is the This? If we take it in the two-fold form of its existence, as the Now and as the Here, the dialectic it has in it will take a form as intelligible as the This itself. To the question, What is the Now? we reply, for example, the Now is night-time. To test the truth of this certainty of sense, a simple experiment is all we need: write that truth down. A truth cannot lose anything by being written down, and just as little by our preserving and keeping it. If we look again at the truth we have written down, look at it now, at this noon-time, we shall have to say it has turned stale and become out of date.   Hegel,  Phenomenology of Spirit  S. 95 Overview In philosophy, English words like "this" are referred to as indexicals, with the implication that (A) they are used to point at something and (B) what they point at is determined by context (just as, when I point at someone, who I am pointing at is determined ...

Compiling and Executing Java Files With -cp

I decided I was going to "man up" and figure out how to compile a java program with an external dependency from the command line instead of relying on an IDE-- the DOS command line, to be more specific. I ran into a few problems: 1.  The external dependency was given to me as a java file.  I experimented compiling it as a .jar, but I wasn't sure how to import a class from a .jar, so I ended up compiling it into a class. 2.  When I tried to run the file, I got an error saying that the class had been compiled with a different version of Java than my JRE.  The Internet told me to check my path variable for Java.  It sure looked like it was pointing to the latest JRE (and the same version of Java as my compiler).  I asked the Internet again and found the following command: for %I in (java.exe) do @echo %~$PATH:I I'm not exactly sure what the syntax of that magic command is (intuitively it's returning the path that executes when I run the "java" com...

Shell Sort Notes

I don't understand this passage.  What are the two alternatives? ( Algorithms , 258) One way to implement shellsort would be, for each h, to use insertion sort indepen- dently on each of the h subsequences. Because the subsequences are independent, we can use an even simpler approach: when h-sorting the array, we insert each item among the previous items in its h-subsequence by exchanging it with those that have larger keys (moving them each one position to the right in the subsequence). Have to research different implementations of Shell Sort.  Would also help to clarify the mistake I made in my discussion yesterday. Having said that, I can think of two possibilities.  Given, for instance, h  of 3   and a sequence: 1 2 3 4 5 6 7 8 9 -- two methods would be first : Compare and exchange 1 and 4... ...2 and 5 ...3 and 6 ...4 and 7 ...5 and 8 ...6 and 9 -- or second : Do an insertion sort on 1, 4, and 7 Do an insertion sort on 2, 5, and 8 ...

Shell Sort

Today I spent a little bit of time researching the "Shell" sort.  I wanted to post a few notes about the Princeton Algorithms Course's implementation to help me solidify my understanding. First, a little tidbit.  When I first heard about this algorithm, I thought it had something to do with shell games.  Turns out a man named Donald Shell discovered this method of sorting, whence the name. The Algorithms  book gives the following explanation (Sedgewick and Wayne,  Algorithms, 4th ed., p. 258): The idea is to rearrange the array to give it the property that taking every hth entry (starting anywhere) yields a sorted subsequence. Such an array is said to be h-sorted. Put another way, an h-sorted array is h independent sorted subsequences, interleaved together. By h-sorting for some large values of h, we can move items in the array long distances and thus make it easier to h-sort for smaller values of h. Using such a procedure for any sequence of values o...

Diary

First day as a TA at Coding Dojo Worked up through the automated testing portion of the Django official tutorial Didn't have time to do any algorithms -- learned about a path-finding problem (2D array represents connections between nodes -- determine whether there is a path from A to B for arbitrary A and B) e.g. for nodes A, B, and C [ [0, 1, 0] , [0 , 0, 1], [0, 0, 0] ] First entry says A is connected to B, second that B is connected to C -- so there's a path from A to C. The connection relationship is not robust.  A can be connected to B without B being connected to A.  It must however in some sense give rise to another relationship that is at least transitive.  If A and B are connected, and B and C are connected, then I can get from A to C.  This does not mean, however, that I can get back from C to A. Initial thought was do something with recursion.  Too complicated.  And what if you have loops?  Now it seems you just need a way to trans...

How To Get More Out Of Tutorials

We all follow tutorials.  Coming up with an idea for a new app, including the scaffolding and the specific functionality, is hard.  Struggling through something on your own can be valuable and helps you internalize it, but you also risk "reinventing the wheel" if you fail to take advantage of the resources and experience available from those who have "done it before."  Tutorials help you work through an ambitious project step by step and "learn while doing."   But blindly copying someone else's code without knowing why you are doing what you are doing can severely limit your learning.  Use the following steps to get the best of both worlds -- a dedicated teacher who will guide you every step of the way through the app you want to make AND a system that will hold you responsible for what you learn and help you to internalize it so that you can generalize specific steps for future pet projects (or work assignments). 1. Pause The Tutorial Pause t...