Compare commits

...

13 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire c8a570e3ac Projects
- Typo fixes
- Formatting fix
2024-03-31 14:19:36 +02:00
Tristan B. Velloza Kildaire 9721514697 Hot takes
- Updated
2024-03-31 14:19:16 +02:00
Tristan B. Velloza Kildaire c05d111254 Projects
- Updated link
2024-03-31 14:19:06 +02:00
Tristan B. Velloza Kildaire 1d9bb1c613 Home
- Cleaned up
2024-03-31 14:18:46 +02:00
Tristan B. Velloza Kildaire 04b1536f63 Libsnoose
- Typo fixes
2024-03-31 14:18:16 +02:00
Tristan B. Velloza Kildaire 765f539d21 About page
- Added link to obviously non-existent CV
2024-03-31 14:04:11 +02:00
Tristan B. Velloza Kildaire 9725cd4bb6 Networks
- Removed old page
2024-03-31 14:03:16 +02:00
Tristan B. Velloza Kildaire d80f2cd9f0 Homepage
- Updated donation information
- Re-worked networking information
2024-03-31 14:02:11 +02:00
Tristan B. Velloza Kildaire 9ef56f1918 Footer
- Cleaned up
2024-03-31 13:57:44 +02:00
Tristan B. Velloza Kildaire 50abc4d1ee List layout
- Never render on the homepage
2024-03-31 13:57:33 +02:00
Tristan B. Velloza Kildaire 94930847df List layout
- Now groups by year and includes the day and month published
2024-03-31 13:33:48 +02:00
Tristan B. Velloza Kildaire 7e705128e1 List
- Working on my own new layout for the listing mechanism
2024-03-31 13:16:52 +02:00
Tristan B. Velloza Kildaire 479add8444 Homepage
- Added link to liberapay account
2023-12-23 09:52:06 +02:00
9 changed files with 80 additions and 88 deletions

View File

@ -3,46 +3,55 @@ title: Home
---
{{<bruh>}}
<!--
<img src="/img/profile_pic.jpg" width="250" hieght="250" style="float:right;gap">
-->
<img src="/img/profile_pic_honors_grad.jpg" width="172.8" hieght="259" style="float:right;gap;margin-left:10px;margin-bottom:10px">
{{</bruh>}}
<br>
# Tristan B. Velloza Kildaire
## _A masochistic engineer_
I'm Tristan B. Kildaire (or _deavmi_ on the Internet) and I'm a computer programmer. I love tinkering around with all the bits of software
I'm Tristan B. Velloza Kildaire (or _deavmi_ on the Internet) and I'm a computer programmer. I love tinkering around with all the bits of software
that my computer runs but typically more on the low-level sides of things. I'm really interested in how operating systems work as a whole
and their components such as kernels, networking stacks, linking-loaders, IPC, paging, virtual memory, file-systems and the list goes on. There's so much to learn from understanding these complex systems and each aspect of them never leaves me bored!
and their components such as kernels, networking stacks, linking-loaders, IPC, paging, virtual memory, file-systems and the list goes on. There's
so much to learn from understanding these complex systems and each aspect of them never leaves me bored! I really enjoy the C programming language,
coupled with your console editor of choice and a few man pages at hand - you can do a lot with this powerful combo.
You could call me a language enthusiast, from the design to the implementation. I always want to know how things work and I've even spent time reading the source code for some language runtimes to get a better understanding. If I am feeling creative then I try write my own _or_ write something in Forth! I love building networks too - I have an interest in setting up inter-networks with routing protocols, assigning numbers and setting up tunnels in order to build a huge network that I can play around on. When I'm not using other peoples' protocols I am busy writing my own to see what I can cobble out to itch my scratch on trying interesting concepts out.
I like a good glass of red wine and cheese. I have an avid enjoyment for music from the 70s and the 80s and have rather interesting political views (nothing to be alarmed of) but most importantly I like to help others learn and put a smile on their face.
## Explore some more
## See what I am working on
You can head over to the [projects page](/projects) to see what I am working on (or have worked on) and then once you're done there you can head on over to my blog to read some computer musings.
You can reach this site via many more [networks](networks/) (such as I2P and CRXN).
## Connect with me
I'm active on a few social media platforms and post regularly (or not) but I definitely do
check these platforms now and then so if you want to discuss something then it isn't a bad
way to get in touch and also stay upt-o-date with updates regarding to new blog posts or
projects.
* Nostr: [`npub16c2fsg7fp3yxte9ugd9yhcdpa68h924asv5d6pvm5nc37a3nkzmqd2xaj2`](https://njump.me/deavmi@deavmi.assigned.network) or _deavmi@deavmi.assigned.network_
* Fediverse: [`deavmi@ieji.de`](https://ieji.de/@deavmi)
## Donations
{{<bruh>}}
<img src="/img/donate.png" width="200" hieght="200" style="float:right;wrap">
{{</bruh>}}
If you like what I _do_ and don't mind shilling a _few_ then you can send me some Internet money (note I don't accept PayPal or any centralised service) or a gold certificate. The aim of the donations are to show appreciation for my work. If, however, you are interested in donating to one of my projects (whereby the money goes towards it) then please find the respective donation link on their project pages.
{{<bruh>}}
<br>
<br>
{{</bruh>}}
If you like what I _do_ and don't mind **shilling** a _few_ then you can send me some Internet monies in the form of crypto-currency or
you can opt for using a service from the legacy financial system.
* Monero: `86reDCjk99VJ8QCo73WwM1AtfweD2fp8RPPWzNK56cdS1fAfxWCwixic9QrXkHyoJSe3gMZkAkb8aW5oU4cLEFucMLX4wqP`
* Bitcoin: `bc1qkvduq9rwray2ymrvkrven3m8vsp9ah55f4hnc4`
* Liberapay: [tbvk](https://liberapay.com/tbvk/)
{{<bruh>}}
<br>
{{</bruh>}}
_I am not a slave to the global financial system_
---
---
You can reach this site using other methods:
* On I2P at `deavmi.i2p`
* On Yggdrasil at `203:75b7:45af:ecca:d641:cd42:38dc:4788`
* On IPFS at `k2k4r8mo00wff79hhfnog9tpjksudhyfpz27yso7phbvhoeh5byk0xml`

View File

@ -10,7 +10,7 @@ If you have read the homepage section then you know pretty much all there is to
## Curriculum Vitae
You can find a copy of my CV [here]().
You can find a copy of my CV [here](/cv/).
## Contact information

View File

@ -2,12 +2,12 @@
title: 💤️ libsnooze - a wait/notify mechanism for D
author: Tristan B. V. Kildaire
date: 2023-03-19
draft: true
draft: false
---
# What is libsnooze?
I decided I wanted a mechanism similiar to that of Java's wait/notify mechanism whereby a thread can be put to sleep and then another can wake it up when it sees fit. The waking up is normally done on some condition on the calling thread - it's a rather common need in multi-threaded programs that are cooperating on shared data structures.
I decided I wanted a mechanism similar to that of Java's wait/notify mechanism whereby a thread can be put to sleep and then another can wake it up when it sees fit. The waking up is normally done on some condition on the calling thread - it's a rather common need in multi-threaded programs that are cooperating on shared data structures.
Now, one may think:
@ -41,7 +41,7 @@ public class MyThread : Thread
}
```
Now, I will spawn the second thread which will start to loop indefinately in `worker()`:
Now, I will spawn the second thread which will start to loop indefinitely in `worker()`:
```d
MyThread thread2 = new MyThread();
@ -67,17 +67,17 @@ I am now ready!
## Issues with joining spinclass
Barr the obvious fact that I don't want to be caught in 4K wearing tights for a spinclass there is a problem with this implementation. But don't fret it isn't one to do with the implementation's _idea_ so to speak. It is a logical implementation and should work (and does), the problem is with _performance_ of the _rest_ of your machine's processes and heat generation and energy usage (the latter of which I only became aware of because certain CPUs can actually powersave in certain conditions).
Barr the obvious fact that I don't want to be caught in 4K wearing tights for a spinclass there is a problem with this implementation. But don't fret it isn't one to do with the implementation's _idea_ so to speak. It is a logical implementation and should work (and does), the problem is with _performance_ of the _rest_ of your machine's processes and heat generation and energy usage (the latter of which I only became aware of because certain CPUs can actually power save in certain conditions).
Woah, that's a lot - let's break this down first of all and start off with a description of a few things which one must understand about hardware and operrating systemn software.
Woah, that's a lot - let's break this down first of all and start off with a description of a few things which one must understand about hardware and operating system software.
### Scheduling and the run-queue
The kernel is what schedules processes. Every certain number of milliseconds an interrupt fires (due to a hardware timer, like an eggtimer on repeat), this is then picked up at the end of processing a single instruction, if the interrupt register is non-zero (for explanations sake), then the number is used as an offset into a table of function handlers for that interrupt type. The specif interrupt here is the system timer which tyhe kernel has a handler for.
The kernel is what schedules processes. Every certain number of milliseconds an interrupt fires (due to a hardware timer, like an egg timer on repeat), this is then picked up at the end of processing a single instruction, if the interrupt register is non-zero (for explanations sake), then the number is used as an offset into a table of function handlers for that interrupt type. The specif interrupt here is the system timer which the kernel has a handler for.
This handler is used to save the context of the current process, its open files, memory map, instruction pinter (where we were in the program) etc.. The kernel then moves this process to the back of the run queue and looks at the head of the queue and switches the context for that process in. This process repeats.
Now, a program that never sleeps or does any I/O will remain in the runqueue and is what I call _"highly schedulable"_ as it can always be immediately run. If we look at the second thread (which in UNIX is just a process with certain flags that make it considered what is seen as a _"thread"_) it cannot sleep - why is that? Well, there is no I/O system calls such as those which would place it to sleep for perhaps reading a file of which bytes have not been made available yet (the I/o request yet to be fulfilled). It also never calls `sleep(5)` like our main thread does. **It can _only_ remain in the run queue** (unless it crashed which it won't).
Now, a program that never sleeps or does any I/O will remain in the run queue and is what I call _"highly schedulable"_ as it can always be immediately run. If we look at the second thread (which in UNIX is just a process with certain flags that make it considered what is seen as a _"thread"_) it cannot sleep - why is that? Well, there is no I/O system calls such as those which would place it to sleep for perhaps reading a file of which bytes have not been made available yet (the I/o request yet to be fulfilled). It also never calls `sleep(5)` like our main thread does. **It can _only_ remain in the run queue** (unless it crashed which it won't).
#### Problem 1: Time quantum starving
@ -87,7 +87,7 @@ Now imagine we add a 5 process here, this will mean we need about (worst case) 1
The idea I am trying to drive home here is its meaningless work is making the other processes take longer to complete their full job (`10` seconds in total is greater than `8` seconds in total).
_What if we could change that?_ so it didn't stay in the runqueue till it was ready to do work?
_What if we could change that?_ so it didn't stay in the run queue till it was ready to do work?
In fact, you will see most programs tend to not cap your run queue on a normal desktop if you open up `htop` for example. The times it will would be strenuous tasks like compilations etc, those however, are doing _"real work"_ - they just have hardly any I/O (and they definately wouldn't sleep - _why would a compiler sleep_). Most processes are waiting for I/O to complete (and there are various uses of this as we will see) or sleeping for a fixed amount of time.
@ -97,19 +97,19 @@ I'm no engineer but I know the more components you have turned on the more a sin
CPUs such as those that are `x86` support an instruction known as `HLT` which, if called, will disable certain components in the CPU till the next interrupt occurs (waking it from this state), this can save a lot of power in the long run. Now, the way the Linux deals with this is that if there isn't anything at this moment that can be scheduled then it runs a kernel task that calls `HLT` in a loop. THis will momentarily power save until an interrupt goes off - one of which is the task switching interrupt, the kernel can wake up for a burst (the CPU hardware turns out and resumes drawing more current) and the kernel can check _"Are there any tasks available to schedule?"_, if not it sleeps again. This means you do more sleeping than waking and you save power doing this.
So you can see why keeping the user process runqueue as empty as possible - when it makes sense to, has more than one benefit.
So you can see why keeping the user process run queue as empty as possible - when it makes sense to, has more than one benefit.
---
## Okay, well then how do you fix this? 🤔️
If we know that applications go to sleep (i.e. are removed from the run queue and placed into another queue) when they do I/O whilst a pending I/O request it put out (and late fulfilled, placing the process back in the run-queue), then how could we do that but without taxxing our harddrive with tiny little write requests?
If we know that applications go to sleep (i.e. are removed from the run queue and placed into another queue) when they do I/O whilst a pending I/O request it put out (and late fulfilled, placing the process back in the run-queue), then how could we do that but without taxing our hard drive with tiny little write requests?
Well, glad you asked. I actually read about this whilst reading about [`eventfd`](https://man7.org/linux/man-pages/man2/eventfd.2.html) because prior to it there is a way to easily do this- get ready mario fans because it's time for _pipes_.
### What is a `pipe`? 🕳️
A _pipe_ is an in-memory kernel-managed queue effectively. Opening a pipe, using `pipe(int*)`, will create a new pipe and then (ensuring that the `int*` passed in pointed to 2 contiguosuly available integers), then it will place two numbers in this array. The first index will be a file descriptor to what is known as the _read end of the pipe_, then second will be a file descriptor to what is known as the _write end of the pipe_.
A _pipe_ is an in-memory kernel-managed queue effectively. Opening a pipe, using `pipe(int*)`, will create a new pipe and then (ensuring that the `int*` passed in pointed to 2 contiguously available integers), then it will place two numbers in this array. The first index will be a file descriptor to what is known as the _read end of the pipe_, then second will be a file descriptor to what is known as the _write end of the pipe_.
If you write a single byte to the pipe, then a single byte will be available for reading on the read end. It's a FIFO provided by the kernel and with a file interface! Well, we can use this then! We can make a thread read in a blocking manner with an I/O request of a single byte on the _read end of the pipe_, it will then be placed into the I/O waiting queue and only be brought back into the run queue for scheduling when that I/O request is fulfilled.
@ -149,7 +149,7 @@ Firstly we create an `Event` which is something that can be notified or awaited
Event myEvent = new Event();
```
Now let's create a thread which consumes `myEvent` and waits on it. You will see that we wrap some exception catching around the call to `wait()`. We have to catch an `InterruptedException` as a call to `wait()` can unblock due to a signal being received on the waiting thread, normally you would model yoru program looping back to call `wait()` again. Also, if there is a problem with the underlying eventing system then a `FatalException` will be thrown and you should handle this by exiting your program or something.
Now let's create a thread which consumes `myEvent` and waits on it. You will see that we wrap some exception catching around the call to `wait()`. We have to catch an `InterruptedException` as a call to `wait()` can unblock due to a signal being received on the waiting thread, normally you would model your program looping back to call `wait()` again. Also, if there is a problem with the underlying eventing system then a `FatalException` will be thrown and you should handle this by exiting your program or something.
```d
class TestThread : Thread
@ -188,7 +188,7 @@ TestThread thread1 = new TestThread(event);
thread1.start();
```
Now on the main thread we can do the following to wakeup waiting threads:
Now on the main thread we can do the following to wake up waiting threads:
```d
/* Wake up all sleeping on this event */

View File

@ -2,4 +2,4 @@
title: Hot takes
---
None, so far :).
You really fell for this one didn't you.

View File

@ -1,43 +0,0 @@
---
title: Networks
---
This site is made available through several networks to make accessing its contents more easier for those living in regions with censorship or thoe who simply want to access it over a different networkk.
# Current networks
The below are the currently supported networks. If you have a request for another one to be added then please contact me via my details on the [about me](../about/) page.
## I2P
There is I2P access for this site.
* I2P Domain: [`deavmi.i2p`](http://deavmi.i2p)
* I2P B32 address: [`fh5r3hlkkwh7udtjeqmekmq4qd62jnjqmnqob5hm3ndiuo6lauza.b32.i2p`](http://fh5r3hlkkwh7udtjeqmekmq4qd62jnjqmnqob5hm3ndiuo6lauza.b32.i2p)
## Yggdrasil
There is Yggdrasil access for this site.
* Yggdrasil address: [`203:75b7:45af:ecca:d641:cd42:38dc:4788`](http://[203:75b7:45af:ecca:d641:cd42:38dc:4788])
## CRXN
There is CRXN access for this site.
* CRXN address: [`fdd2:cbf2:61bd:0:0:0:0:2`](http://[fdd2:cbf2:61bd:0:0:0:0:2])
## Clearnet IPv4/IPv6
There is clearnet (normal Internet) access for this site.
* Domain: [`deavmi.assigned.network`](http://deavmi.assigned.network)
* This domain can resolve to IPv4 or IPv6
* IPv6: [`2a04:5b81:2010::33`](http://[2a04:5b81:2010::33])
* IPv4: [`45.87.161.101`](http://45.87.161.101)
## IPFS
You can fetch the contents of this site off of IPFS via the following IPNS name `k2k4r8mo00wff79hhfnog9tpjksudhyfpz27yso7phbvhoeh5byk0xml`.
That name-pointer gets updated to the correct IPFS CID every now and then when I decide to update the IPFS-version to the latest-live version.

View File

@ -265,7 +265,7 @@ A new chat binary protocol aiming to replace IRC with modern day features.
## Butterfly
Butterfly is a full email system that uses JSON-based messaging embedded in [bformat](). It provides a single server that acts as both mail delivery and mailbox management system (analog to providing SMTP and POP/IMAP in one single service). It supports client-to-server connectivity along with server-to-server connectivity for inter-server mail delivery.
Butterfly is a full email system that uses JSON-based messaging embedded in [bformat](/projects/bformat). It provides a single server that acts as both mail delivery and mailbox management system (analog to providing SMTP and POP/IMAP in one single service). It supports client-to-server connectivity along with server-to-server connectivity for inter-server mail delivery.
1. [butterflyd homepage](/projects/butterfly)
* This provides the mail server

View File

@ -7,7 +7,7 @@ title: Tristanable
{{</bruh>}}
**Tristanable** is a library for D-based libraries and applications that need a way to receive variable-length messages of different types (via a `Socket`) and place these messages into their own resepctively tagged queues indicated by their _"type"_ or `id`.
**Tristanable** is a library for D-based libraries and applications that need a way to receive variable-length messages of different types (via a `Socket`) and place these messages into their own respectively tagged queues indicated by their _"type"_ or `id`.
* [GitHub](http://github.com/deavmi/tristanable)
* [DUB page](https://code.dlang.org/packages/tristanable)
@ -16,13 +16,13 @@ title: Tristanable
### Human example
Say now you made a request to a server with a tag `1` and expect a reply with that same tag `1`. Now, for a moment, think about what would happen in a tagless system. You would be expecting a reply, say now the weather report for your area, but what if the server has another thread that writes an instant messenger notification to the server's socket before the weather message is sent? Now you will inetrpret those bytes as if they were a weather message.
Say now you made a request to a server with a tag `1` and expect a reply with that same tag `1`. Now, for a moment, think about what would happen in a tagless system. You would be expecting a reply, say now the weather report for your area, but what if the server has another thread that writes an instant messenger notification to the server's socket before the weather message is sent? Now you will interpret those bytes as if they were a weather message.
Tristanable provides a way for you to receive the "IM notification first" but block and dequeue (when it arrives in the queue) for the "weather report". Irresepctoive of wether (no pun intended) the weather report arrives before the "IM notification" or after.
Tristanable provides a way for you to receive the "IM notification first" but block and dequeue (when it arrives in the queue) for the "weather report". Irrespective of wether (no pun intended) the weather report arrives before the "IM notification" or after.
### Code example
If we wanted to implement the following we would do the following. One note is that instead of waiting on messages of a specific _"type"_ (or rather **tag**), tristanable provides not just a one-message lengthb uffer per tag but infact a full queue per tag, meaning any received message with tag `1` will be enqueued and not dropped after the first message of type `1` is buffered.
If we wanted to implement the following we would do the following. One note is that instead of waiting on messages of a specific _"type"_ (or rather **tag**), tristanable provides not just a one-message length buffer per tag but in fact a full queue per tag, meaning any received message with tag `1` will be enqueued and not dropped after the first message of type `1` is buffered.
```d
import tristanable.manager;
@ -46,7 +46,7 @@ manager.addQueue(instantNotification);
QueueItem message = weatherQueue.dequeue();
```
Surely, there must be some sort of encoding mechanism too? The messages afterall need to be encoded. **No problem!**, we have that sorted:
Surely, there must be some sort of encoding mechanism too? The messages after all need to be encoded. **No problem!**, we have that sorted:
```d
import tristanable.encoding;
@ -62,7 +62,7 @@ DataMessage tristanEncoded = new DataMessage(tag, data);
socket.send(encodeForSend(tristanEncoded));
```
And let tristanable handle it! We even handle the message lengths and everything using another great project [bformat](http://deavmi.assigned.network/projects/bformat).
And let tristanable handle it! We even handle the message lengths and everything using another great project [bformat](/projects/bformat).
## Format
@ -76,6 +76,4 @@ project's root:
```bash
dub add tristanable
```
---
```

View File

@ -0,0 +1,28 @@
{{ partial "header.html" . }}
{{if not .IsHome }}
<h1>{{ .Title | markdownify }}</h1>
{{ end }}
{{ .Content }}
<ul>
{{ if not .IsHome }}
{{ $allBlogs := .Pages.GroupByDate "2006" }}
{{ range $allBlogs }}
<h2>{{.Key}}</h2>
{{ range .Pages }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
<b>{{.Date.Day}} {{.Date.Month }}</b>
</li>
{{end}}
{{end}}
{{end}}
</ul>
{{ partial "footer.html" . }}

View File

@ -1,2 +1,2 @@
<a href="http://redxen.eu/"><img src="imgs/rx_gang.png" alt="" moz-do-not-send="true" width="88" height="31" border="0"> </a><a href="/projects/crxn"><img src="imgs/crxn_gang.png" alt="" moz-do-not-send="true" width="88" height="31" border="0"></a>
<img src="imgs/web_1.gif" alt="" moz-do-not-send="true" width="100" height="30" border="0"> <img src="imgs/linux_gang.gif" alt="" moz-do-not-send="true" width="88" height="31" border="0"><a href=""> </a><a href="http://redxen.eu/"><img src="imgs/rx_gang_animated.gif" alt="" moz-do-not-send="true" width="88" height="31" border="0"></a>
<img src="imgs/web_1.gif" alt="" moz-do-not-send="true" width="100" height="30" border="0"> <img src="imgs/linux_gang.gif" alt="" moz-do-not-send="true" width="88" height="31" border="0"><a href=""> </a><a href="http://redxen.eu/"><img src="imgs/rx_gang_animated.gif" alt="" moz-do-not-send="true" width="88" height="31" border="0"></a>