{"id":33,"date":"2006-04-26T16:28:33","date_gmt":"2006-04-26T20:28:33","guid":{"rendered":"http:\/\/journal2.alanv.org\/?p=33"},"modified":"2012-10-07T22:44:54","modified_gmt":"2012-10-08T02:44:54","slug":"threading-ahh","status":"publish","type":"post","link":"https:\/\/journal2.alanv.org\/?p=33","title":{"rendered":"Threading ahh"},"content":{"rendered":"<p>Yeah, so I finished 312 finally. We implemented threading in ML (and used it to implement speculative memory). It is horrific, but it works.<br \/>\nThe last error I had was a stupid one too, and it&#8217;s one that I really should have caught.<\/p>\n<p>We have a function scheduler that goes through a list of threads and runs them, one at a time.<br \/>\nIts type should be <code>'data * 'data state -> 'b<\/code> since the function never returns, it just calls the next thread when one is done executing.<br \/>\nThe type of mine was <code>'data * 'data state -> 'data * 'data state<\/code><br \/>\nThis should have been a tipoff for me that something was wrong with the function.<br \/>\nIt wasn&#8217;t.<br \/>\nI spent like two days trying to figure out why things were encountering empty thread lists and trying to release locks twice.<br \/>\n&#8230;<br \/>\nAs Dan said, &#8220;You are 8 characters away from being correct.&#8221; I had forgotten to do a recursive call to scheduler inside scheduler, which meant I was returning the result of computations instead of running the next computation, as desired.<br \/>\nGAAH.<\/p>\n<p>Oh well, it works now, so I&#8217;m happy.<\/p>\n<p>Um, not much else. I really should be studying for 21301 and 18100. Meh. And I have 18100 lab tonight, which sucks. Meh.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yeah, so I finished 312 finally. We implemented threading in ML (and used it to implement speculative memory). It is horrific, but it works. The last error I had was a stupid one too, and it&#8217;s one that I really &hellip; <a href=\"https:\/\/journal2.alanv.org\/?p=33\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=33"}],"version-history":[{"count":0,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions"}],"wp:attachment":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}