7 ms·
Is_computer_on_fire() (2000)
- chiph 12y agoI was just thinking about BeOS the other day. If you recall, Be had fantastic multithreading, and could render multiple video streams at the same time. They even gave you a file on the distribution CD to test this capability: https://www.youtube.com/watch?v=2jMFiRvxvrc https://www.youtube.com/watch?v=2jMFiRvxvrc
- anon4 12y agoI keep hearing about Be's mt capabilities, but I haven't read anything in detail. Can you point me to some materials that explain how it's different from e.g. Linux?
- jimbosis 12y agoI'm no expert, but you might find the BeBook, which "...details the Application Programming Interface (API) to the BeOS operating system," to be an informative starting point (though you won't find a comparison with Linux there). There are chapters on "Threads and Teams" in the two sections on the "Kernel Kit" (that's as far as I looked, maybe other parts of the book would be more informative). https://www.haiku-os.org/legacy-docs/bebook/ https://www.haiku-os.org/legacy-docs/bebook/
- dnautics 12y agoYeah... It's been years since I thought about this, but: for linux you basically have two options: fork() and pthreads. Fork creates a new process and IPC between the parent and daughter processes can be cumbersome - and it's not a terribly good system since if you're spawning a process to do a different task, the default state contains overhead of the old task. Pthreads gives you shared memory (and simple mutexes to protect critical data) but that's about it. Beos' app model discouraged the use of fork() - but you could if you wanted to - and instead had a pthreads-like kernel level support for threads with some very nice C classes that handle message-passing and the like; interthread communication was baked in in too so you could have strong IPC without pipes. BeOS also came with a hybrid spinlock-semaphore mutex called the 'benaphore'. There were some very excellent C++ wrappers for all of these too, the BLooper class was a by-default message handling loop (for example). Finally, the threading model was pretty cool, it was a logarithmic stochastic time allocator with a range of "hard priorities" that would give you RT control (but could also freeze your machine if you had an infinite loop). Unfortunately the kernel had a tendency to thrash threads between CPUs in a multi-cpu setup. I think this was fixed in Haiku.
- chiph 12y agoI never saw the internals, but from a coder's standpoint the thread switches were really fast, with low latency. Compared with Windows NT and OS/2, way faster on the same hardware. I don't have a comparison with Linux, as it was just getting started back then (IIRC, Slackware was the leading distro of the time)
- Kiro 12y agoIs ariels's critique valid? Is that best practice for functions returning a boolean? What about applying the same logic to a function returning a number between X and Y? if (random_number_between(1, 10) > 5) { do_something(); } Is this correct? I would personally name such functions get_random_number_between instead but that violates this principle.
- jschwartzi 12y agoIt matters less what the convention is than that there is a convention in your codebase and that it makes clear what the affirmative case is.
- rab_oof 12y agoYup. It's important to have functioning code that mere mortals can understand most easily. Because the code represents system behavior and people need unambiguous conventions to reduce misunderstanding and prevent introduction of errors along the way.
- NickPollard 12y ago'best practice' is a difficult concept when it comes to naming things, which is one of the two hard problems of computer science. However, I agree with ariel. In a functional-style program, or indeed in most programs, the important thing about a function is what it returns, not what it does. Calling a function 'getRandomNumber' describes the action of the function, not the return value, which is just 'randomNumber'. As your example shows, the logic in English flows much more naturally with the latter. It's much better to talk about the box.size, rather than the box.getSize, for example. To me, the presence of 'get' in a function name is almost always a bad idea. Similarly, I normally use the word 'as' rather than the word 'to' when naming conversion functions, e.g. list.asArray, rather than list.toArray
- laumars 12y agoYou make some valid points, but what about instances where you have a getter and a setter?
- deleted 12y ago[deleted]
- agildehaus 12y agoRe-implemented in Haiku: https://github.com/haiku/haiku/blob/master/src/system/libroot/os/system_info.cpp#L193 https://github.com/haiku/haiku/blob/master/src/system/libroo...
- ComSubVie 12y agoI would have expected something more creative than a static number.
- mveety 12y agoThat's pretty much the behaviour on anything that isn't a BeBox. I had a program I wrote that used this on my BeBox and when I moved to 5 Pro on a Pentium it kept giving the same tempurature.
- astine 12y agoI dunno. I'm curious as to why they chose that particular number.
- bobbyi_settv 12y agoPatches welcome
- ams6110 12y agoI'd like to see the unit test for that one.
- jesuslop 12y agoMaybe one can try the HCF assembly extension as in http://en.wikipedia.org/wiki/Halt_and_Catch_Fire http://en.wikipedia.org/wiki/Halt_and_Catch_Fire
- digi_owl 12y agoI guess it goes well with the old UNIX printer error. https://en.wikipedia.org/wiki/Lp0_on_fire https://en.wikipedia.org/wiki/Lp0_on_fire
- leakybucket 12y agoAs I recall, we used this for system call testing/timing. (I worked at Be.)
- niklasni1 12y agoYou can't just say you worked at Be and not tell more stories! When were you there and what did you do? Why do you think you didn't take over the world? Have you tried Haiku?
- mkramlich 12y agoindeed. Be belongs to a list of companies that would be great to hear insider stories about. also NeXT, Thinking Machines, Symbolics (sp?), Infocom, Cray, etc
- ComputerGuru 12y agoYes, as I understand it, is_computer_on and is_computer_on_fire were basically no-ops to benchmark kernel calls. One returns an integer and the other a double. But I could be very wrong, I have absolutely zero authoritative knowledge and this is simply an explanation I once heard that made sense to me.
- code_duck 12y ago'is_computer_on()' is an interesting corollary.
- SapphireSun 12y agoI guess it returns a falsy value (null) if the computer isn't on.
- shultays 12y agoIt is undefined behaviour
- Aardwolf 12y agoThe documentation is incomplete, it doesn't say whether it's in Kelvin or Celcius.
- Intermernet 12y agoDegrees Rankine. http://en.wikipedia.org/wiki/Rankine_scale http://en.wikipedia.org/wiki/Rankine_scale
- slm_HN 12y agoThis somehow reminds me of the show Halt and Catch Fire, which was one of the most god-awful shows I've ever watched. After Breaking Bad, Mad Men and The Walking Dead I expected a little more from AMC.
- DrewRWx 12y agoYet somehow it was renewed for a second season. I can't wait!
- deleted 12y ago[deleted]
- bluedino 12y agoWhat was Everything2 supposed to be? I remember it was almost like a Wikipedia thing that never really matured and it always seemed really slow. The Blockstackers guys from Slashdot built it, didn't they?
- raldi 12y agoI remember that the first Everything was at everything.blockstackers.com.
- SwellJoe 12y agoKind of a more loosely structured WikiPedia, with fewer rules and a lot more opinion. It's probably more comparable to the original wiki wiki web, by Ward Cunningham (c2.com, which contains a little bit of everything, kinda like everything2), though it evolved in different directions. It developed more focus on creative writing and commentary over the years, with less emphasis on encyclopedia style articles or technical articles, though I haven't paid attention to it in like a decade. I was very excited about it when it first came about, though. It was closely related to Slashdot, but when Slashdot was sold, E2 remained independent.
- chromatic 12y agowhen Slashdot was sold, E2 remained independent. Some of the profits of the Slashdot sale went to Blockstackers as an investment to develop E2. Unfortunately, the dot-com crash (and, to be fair, not enough effort spent marketing the software) meant there was little market for the underlying CMS.
- alxndr 12y agoAnd the underlying CMS was pretty messy if memory serves.
- SwellJoe 12y agoThere was a time when everything that managed content in some way was being renamed "CMS" in order to fit into a category that was selling at the time. Fitting sometimes very oddly shaped things into the category was common, and I think a lot of cool software got needlessly mangled (TWiki also went off in a lot of weird, occasionally "CMS like", directions to satisfy some sort of enterprise dream that hurt its usability in a lot of ways).
- ungzd 12y agoBTW, this site (everything2.com) suffers from some malicious ad script. If viewed from desktop, everything is ok, if viewed from android browser, it displays this: http://imgur.com/eWUjwHr http://imgur.com/eWUjwHr (text means: "to view this site, UC browser is required", this message cannot be dismissed).
- ASalazarMX 12y agoMost likely your phone has unwanted software or your carrier is injecting ads. At least it seems clean on my Android using Chrome or Firefox.
- jacalata 12y agoI didn't see anything like that on my android phone in chrome.
- SeanLuke 12y agoBetter: the Newton had, as part of the NewtonScript language reference, a built-in "IsHalting" function which tested a function and determined if it would halt with a provided input. See page 23-84 of: http://manuals.info.apple.com/MANUALS/1000/MA1509/en_US/NewtonProgrammerRef20.PDF http://manuals.info.apple.com/MANUALS/1000/MA1509/en_US/Newt...
- scintill76 12y agoIs this just a joke, or is the language and/or function actually limited such that a meaningful return value can be computed?
- SeanLuke 12y agoNewtonScript is very much a Turing-complete language.
- rab_oof 12y agoStyleshedding: bikeshedding on programming language style and declaring only a particular one true way is the only "universal correct" answer. (The tech equivalent of the Islamic State (because Godwins Law is deprecated since Nazis are now no longer the worst possible butchers to which to compare people.)) (Common sense from experience > style guides.)