View on GitHub

Quorten Blog 1

First blog for all Quorten's blog-like writings

Random notes, fireflies, soap notes

2018-06-25

Categories: random  
Tags: random  

Communual bar soap is perfectly safe, as the soap environment is naturally inhospitable to bacteria. It can’t lurk on the surface, especially not after effective hand washing practices, and studies on this have been conducted since 1965. Also, bar soap comes in more environmentally friendly packaging (paper/cardboard) than liquid soap (plastic). Unfortunately, the later generation is showing a decreasing adoption of bar soap due to false fears of it harboring germs, or it is simply less convenient.

Also, wondering why hand soap doesn’t work so well for cleaning objects and floors as it leaves a residue behind? It was deliberately designed to leave that residue, the assumption being that it is an anti-bacterial protecting film. The film might be tolerable on hand surfaces, but it is absolutely despicable on the surfaces of inanimate objects.

Swarm of bees following a car, and using infrared light in a sea robot to detect microplastics in the ocean.

20180625/https://www.treehugger.com/animals/whats-happening-fireflies.html
20180625/https://www.treehugger.com/animals/swarm-bees-follow-car-2-days-rescue-queen-trapped-trunk.html
20180625/https://www.treehugger.com/plastic/genius-6th-grader-invents-device-hunts-harmful-microplastics-ocean.html
20180625/https://www.treehugger.com/green-home/communal-bar-soap-will-not-make-you-sick.html
20180625/https://www.treehugger.com/green-home/bar-soap-sales-slipping-away-millennials-think-its-gross.html
20180625/https://www.treehugger.com/health/keep-away-antibacterial-soaps.html 20180625/

The MIPS architecture is quite a curious architecture indeed. In particular, I must note these aspects that make it different from the x86 architecture:

  • All instructions in MIPS are 32 bits wide. Therefore computing the address of the next instruction early in an instruction execution pipeline is a breeze. Well, principally, unless more advanced modes are toggled to enable 16-bit instructions or otherwise wider ones.

  • There is no explicit instruction to load immediates. Likewise, due to the fixed width of the instructions at 32 bits with a 16-bit immediate, 32-bit immediates cannot be loaded with a single instruction. Instead, a pair of instructions must be used to load a 32-bit immediate, 16 bits at a time.

  • There is no explicit stack register, nor are there explicit push and pop stack instructions. The use of a stack is totally a discretionary decision by the compiler and/or programmer. In practice, this means pairs of instructions are required to push and pop to the stack.

  • In place of a call instruction, there is a “jump and link” instruction that stores the return address inside a register. Should this be destined to go on the stack, the compiler/programmer must push it on within the subroutine. Likewise, there is no return instruction. Instead, there is a “jump register” instruction.

  • Unlike ARM, MIPS does not maintain a conventional flags store containing the zero, sign, carry, and overflow bits. Rather, an instruction must be called to do the comparison and set the result in a register. Well, I guess… this could save energy, as the flag computation logic otherwise continuously consumes energy even when it isn’t being used. However, loading extra instructions also consumes more energy, so I’m not sure if this trade-off is really worth it. For sure a power simulation could determine this with the two alternatives available.

Read on →

Oh, very interesting. The Game Boy and Game Boy color sold 118.69 million units worldwide in its lifetime. Wow, that’s almost as large of a market as modern-day smartphones.

Of course, now that I think about it in hindsight… yeah, our family definitely bought two, not one, Game Boy Colors well before we started buying our first cellphones. Before that, we bought two “toy” cell phones, which were shaped like a real cellphone model, but the fancy telecommunications circuitry was replaced by a tiny, cheap embedded system that did nothing but play pre-recorded PCM waveform sound sequences when different buttons were pushed. In some sense, pretty sophisticated for a toy as the sound quality was quite good, but the embedded electronics circuitry was not quite good enough to be a real cellphone.

20180624/https://en.wikipedia.org/wiki/Game_Boy

Okay, now we’re moving onto the syscall interface for ARM. How do you do it? First thing to remember, there is the old way (OABI = old ABI) and the new way (EABI = embedded ABI).

Old old way:

/* mov dest, src */
mov a0, arg0
mov a1, arg1
mov a2, arg2
swi #(0x900000 + __NR_write)
/* Return value in a0 */

Old way:

/* mov dest, src */
mov r0, arg0
mov r1, arg1
mov r2, arg2
swi #(0x900000 + __NR_write)
/* Return value in r0 */

Read on →

More memory allocation algorithms

2018-06-23

Categories: misc   unlipic  
Tags: misc   unlipic  

More memory allocation algorithms. So, FreeBSD says they have a memory allocation algorithm that bests dlmalloc. So, what are the key things it improves upon?

  • Multiple arenas for multi-threaded use.
  • Classifying page runs by their fullness and using that as a selection criteria.

20180623/http://g.oswego.edu/dl/html/malloc.html
20180623/https://en.wikipedia.org/wiki/Buddy_memory_allocation
20180623/http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf

Looking for other hardware with more processor architectures to program? Of note, my brother bought an Xbox 360 but doesn’t really use it much anymore. That runs a PowerPC CPU, so that’s more hardware to experiment upon with Linux syscalls on PowerPC. Then I would have been able to cover minimal Linux syscall library testing with the following processor architectures:

Easy to reach, physically, literally:

  • i386
  • x86-64
  • MIPS
  • ARM

Harder to reach, physically, literally:

  • PowerPC

These are some omissions that I lament leaving off the list, but must due to the admittable rarity of the hardware:

  • MC68000

Yeah, I do have 68k CPU equipment, it’s just that it’s all too lightweight to run Linux. Not enough RAM, hence it’s out of the picture.

Read on →

Important! Want to install Python packages from Git repositories? Use dependency_links in setup.py, --process-dependency-links, and git+ to do this.

Also, make sure you make your URLs look like this. The version must be included in the “egg” URL or else it won’t work.

https://github.com/.../tarball/master#egg=pkgname-0.9.3

Also, make sure you are using pip >= 9 or else the functionality may have been removed.

20180622/DuckDuckGo setup.py pip dependency links
20180622/https://stackoverflow.com/questions/26061610/pip-install-dependency-links
20180622/DuckDuckGo pip dependency links
20180622/https://stackoverflow.com/questions/46320277/why-is-dependency-links-in-setup-py-deprecated
20180622/https://github.com/pypa/pip

Interesting article on Blaise Pascal

2018-06-22

Categories: random  
Tags: random  

An article about something Blaise Pascal wrote about, people not being able to sit in a roomm alone being the root of all problems. Wanting to not be bored, not wanting to know themselves.

20180622/https://qz.com/1309242/the-most-important-skill-nobody-taught-you/