#MINTIA (not vibecoded)
1 messages ยท Page 13 of 1
so it might just be doomed to have a misnomer
you should've just used ; as NOTHING, then it least it wouldnt be as ugly
and it would kinda make sense
possibly
a = MISNOMER b
yeah
if i called it MISNOMER thatd be a really fun mystery for ppl poking thru mintia2 codebase
i guess NOTHING is mysterious enough already
you should've just made a word up like a = MOXOF b
then people would go "okay so this gets the 'mox' of b. what is a mox" and then they google mox thinking its some arcane terminology theyre unaware of
and they find nothing
or a porn star or something
idfk
infy's suggestion is probably the most sensible lol
I stole this from a @ binder message
unfortunately its already called NOTHING and there are probably dozens of NOTHINGs everywhere in multiple repositories that i dont feel like changing
theres about 100k lines of jackal already
about 50k each in the sdk and mintia2
mintia2 will probably be in the 120-200k range when its "done"
old mintia was 120k lines (of dragonfruit ๐คฎ ) and mintia2 will do a lot more
mintia
> cloc . --read-lang-def=lang.txt
637 text files.
569 unique files.
451 files ignored.
-----------------------------------------------
Language files blank comment code
-----------------------------------------------
Dragonfruit 316 28407 0 79260
Assembly 13 2734 84 6822
C/C++ Header 149 1747 289 4405
make 81 267 1 507
Markdown 3 81 0 154
Text 6 18 0 95
DOS Batch 1 2 0 3
-----------------------------------------------
SUM: 569 33256 374 91246
-----------------------------------------------
``` `cloc` might've counted wrong idk
maybe ur also counting whitespace lol
oh you just said "lines" not "lines of code" ๐
i usually use the same metric people use to measure templeos
which is a straight up count of text lines including whitespace
which is what ppl refer to when they say templeos is 120k lines
i count the same way so i get to say mintia is just as big and have it be fair
lol
last i checked the entire project including all 3 OSes, both sdks, emulator and so on is about 150k-200k sloc
yeah its 290kloc counting whitespace so probably 200ksloc is a conservative estimate
1/5 of a million lines in 5 years, i guess id get to a million sloc in another 20 years
its funny how its actually achievable that i could create an entire like 1990 tier computer ecosystem by myself in a fraction of my lifetime
but then you go like a decade later to y2k and nooooo way
its already orders of magnitude outside the realm of feasibility 10 years later
a "computer ecosystem" (in the sense of the total sources for everything youd have installed on an average personal machine) went from a million sloc to 80 million sloc in like 10 years
neither was i
i was born in 2002
but basically people rapidly shed a bunch of skill issues
and the number of software engineers exploded
in the 90s
what were some major OS advancements
do you mean from a home computer perspective or from a bleeding edge perspective
home computer stuff
they suddenly all got stuff the mainframes had since like 1979
so like paging, protected memory, preemptive multitasking, etc
modern kernels that look basically like the ones we study today trickled down to home computers for the first time in the 90s
they didn't have that before then?? was it because "home computers" before that were mostly stuff like DOS
oh wow I'm just now realizing that lol
macs and PCs were both cooperative multitasking, single address space systems
that started on processors without paging mmu
what happened to the bleeding edge of OSdev then
i think scalability was probably the most marked improvement in the 90s
people started building truly large machines in the 90s like the type you need NUMA for and this compelled scalability advancements in kernel design
the closest to a modern OS on a home computer before then was amigaos
the creators knew about and modeled it on systems like unix
but an MMU was an unaffordable luxury in a home computer at that time
so they compromised and made a system which was an equal to the real OSes in all respects except for no virtual memory
most of the modern fancy features that ppl here aspire to were part of any serious kernel by the end of the 80s, like page swapping and memory mapped files and COW fork and so on. the 90s was less new fundamental features and more improved implementation of the old ones
oh there is one other thing that compelled some big overhauls and new design tactics
i would go as far as to say, we spoke earlier of locking as a fundamental of the design space of a kernel, maybe even prior to in a lot of cases its data structures and algorithms, but almost the only qualitative change in kernel design post 80s was locking (because of need for performant SMP) assuming that position
plug and play
oh, that's a good one
plug and play caused the two major desktop OS vendors to redesign their IO systems
what has even happened since then? I mean I'm only really looking to match the kernels of the 70's to mid-80's, but what are kernels today (the 2020's) doing
the classic NT IO manager (which mostly assumed a static set of devices from boot much like old VMS) gave way to the Pnp manager
and NeXT driverkit gave way to xnu iokit
scalability and security are probably the two biggest areas
security might be bigger now
memory encryption is pretty recent on consumer hardware I think
What features could you call characteristic not of the 80s or 90s, but even the 2000s? For hobby systems, I suppose what might be important is much higher automation and standardisation of devices and device drivers?
if i see lots of lock free stuff and RCU it makes me think 2000s
and strict security features like KPTI
Oh right, security. Lot of talk about it, but what actually changed in kernels in that regard?
thats a good question
i dont know as much about it as i should
other than the basic mitigations for meltdown and spectre and stuff
and ASLR and so on
i think Apple's XNU team and chip team are probably the security pioneers right now
since they put those both under the same roof they can work together to come up with really interesting security features
that require hardware support that doesnt exist with the same robustness on any other platform than apple silicon
their disk controller handles encryption at the hardware level right
pretty neat
you could probably call linux scalability pioneers
idk if NT is pioneering anything other than being pretty
its keeping up at least
maybe memory management pioneers. NT's memory compression and stuff are really good
and they continue to abuse the page tables in unholy ways nobody else dreams of
continuing the vms tradition
Meltdown still seems relevant for Intel systems, I suppose. Fortunately, Apple's moving away from them these days. Only recently learned about ASLR implementation in the kernel, surprised that something conceptually simple (?) requires such clever tricks to work effectively. It involves compiler tricks and probably more, right?
they also employ other stuff like page deduplication that allegedly works well whereas if it exists at all in the other two its like an experimental thing
basically they have a giga memory management autist (affectionate) named landy wang who has been hacking away at their vmm for like 28 years straight
nt is very good as well, they first got securekernel thing and hyperv trust levels and stuff
the dedication of 1 guy for that long can really go a long way i think
ig they try to partner with Intel and their security hw stuff like enclaves
In computing, kernel same-page merging (KSM), also known as kernel shared memory, memory merging, memory deduplication, and page deduplication is a kernel feature that makes it possible for a hypervisor system to share memory pages that have identical contents between multiple processes or virtualized guests. While not directly linked, Kernel-ba...
?
yeah but NT's implementation is apparently Better but dont ask me for details cuz i dont remember if i ever knew them
it uses some clever hashed avl tree thing
oh ok
the one in linux is definitely not an experimental thing
its pretty stable iirc
well im not
did you ever think of that
DID YOU EVER THINK OF THAT!!!!!!!!!!!!
wdym you're the most stable person i know
except for rcu like stuff nt has very rich set of synchronization primitives i believe
is this ironic
irony is in the eye of the beholder 
What about CPU scheduling in particular? Any notable innovations or pioneering efforts there?
itd be funny if you were serious because the quantities of bpd in my personal life are off the charts
successfully redirecting all my insanity away from the osdev community to trick people into thinking im employable
well you definitely have the ability to consistently work on one thing which is commendable
thats what i want you to think
probably
i dont hear much about it so i imagine its nothing revolutionary but theres always room for more schedulers in the world
and refinements to old ones
i guess the windows processor group thing is interesting
but thats not really NEW
also probably isnt unique
they also made more scheduler changes lately
Unique I don't know but they modify and tune it a lot
but those have had mixed reception
As you know user threads can normally get a boost up to 16, but in recent versions I noticed that main thread of interactive apps has priority 21 and it's not something temporary
not to speak badly of our friend, just citing what ive seen
i saw some tech bro gamedev loser on twitter going like "WHATEVER IDIOT IS FUCKING WITH THE WINDOWS SCHEDULER NEEDS TO BE SHOT" or something because they were getting weird behavior and latency spikes on the most recent versions
i thought "no he doesnt..... i like that guy....."
rule 1 of the internet is that anything you say about someone will be read by the person you said it about
The average user is unlikely to notice all these changes as a whole, but will be dissatisfied by default
rule 2 is that itll be read at least by someone who knows that person
basically there are two extremes:
- big scheduler lock, with a single global ready queue shared between all processors.
pros: say you have N available processors. under this scheme, the top N highest priority threads are the ones currently running on those N processors, in perfect balance always
cons: high contention, scales poorly to many processors - per-processor locks, with per-processor ready queues
pros: contention basically disappears
cons: unavoidable and frustrating (but functionally harmless) races are introduced that can cause long term imbalances and starvation of high priority threads, which requires explicit rebalancing
NT people briefly switched from #1 to #2 in win 2k3 i believe (correct me if im wrong)
but then they asked
and basically they group processors together such that groups of i think 4? will all share a single ready queue
so the members of these groups are always balanced among themselves
this is so simple and clever
and the global imbalances are reduced
they still need explicit global rebalancing between the groups sometimes but its not as critical
the ke guy is super smart being able to solve problems in such elegant manner
this probably came from the observation that option #1 i mentioned scales pretty much fine up until like 4-8 processors
so theres no real reason to chunk it up as fine grained as individual processors
you can chunk it up into groups of 4-8
instead
and get the scalability without nearly as big of a sacrifice of balance
so on a big 128 processor machine they might have like 32 ready queues with their own locks
i imagine this also makes the rebalancing algorithm more efficient because there are vastly fewer possible pairs of ready queues to have grave imbalances between
is that a thing to this day?
yes
i imagine its more complex with p/e cores etc
thats interesting
what about NUMA performance? if it's grouping multiple cores into one queue
they would just never have processors from different numa nodes in the same group
the groups align with the topology im p sure
so like hyperthreads on the same core will be in the same group
and so on
if they do work stealing between groups theyd do it in increasing topological distance
I don't know if games can use the benefits of CPU Partitions, but I think this new feature would be useful for them, as it allows them to avoid interference even from DPCs and improve latency in general
i just found it really comical that our friend was telling us about some of the new scheduler features on discord and right after that i see an explosion of outrage on twitter from gamedev influencers
about the exact thing i just heard about personally
what was it particularly
they were just complaining about nebulous latency spikes that didnt happen before and suddenly were happening
i dont know what the root cause was or if it was even a big issue or just them being whiny and whipping up anti-microsoft hysteria among dumb cs kids for clicks
if it was a big issue im sure the smart people in the kernel team noticed quickly and were like ah oops that policy didnt work as well as we hoped / oops theres a bug in the implementation of this new policy causing latency spikes / whatever
and changed it in the next update
these things are way too fluid for people to be that outraged and whiny and disingenuous on twitter
especially now they can change it test it and push it out to everybody in the world in like a few weeks
even if it was the worst scheduler regression in history its still not THAT big of a deal lol
WAHHHH MY VIDO GAME RUN AT 80 FPS INSTEAD OF 100 FPS
IM A BIG OVERGROWN MAN BABY WHO LIKES JINGLING KEYS IN FRONT OF MY FACE ALL DAY
WAHHHH
etc
i hate gamers so much dude
especially dumbass gamedev idiots manufacturing crack for said manbabies and thinking thats respectable enough that they get to rudely throw stones at kernel people
who have real things to worry about like database server performance
mintia2's scheduler will dynamically detect if youre playing a video game and will purposefully starve the shit out of all of its threads JUST to piss you off
strstr the name of the process with a list of known mintia2 games
very good design decision
that sounds like the average anticheat lol... "we will just scan memory for strings that are in cheat programs whats the worst that can happen"
just write a rootkit ๐
mintia2 source leak:
IF RtlCompareString ( &thread^.Process^.Name[0], "valorant.exe" ) == 0 THEN
thread^.Priority = IDLE_PRIORITY
ELSEIF RtlCompareString ( &thread^.Process^.Name[0], "genshinimpact.exe" ) == 0 THEN
KeTerminateProcess ( thread^.Process )
use rust syntax highlighting with discord for jackal btw (if you didnt already know)
it looks better
i like it without the highlighting
makes it look ancient
carved in stone
all VPPERCASE like that
next youll be writing your comments in latin
When I see jackal code, I'm getting tempted to ... no, not kill myself, ๐ I want to write my own C compiler with black jack and ladies for riscv64. Would be a total garbag blast. ๐ But then I remember, that I don't like that architecture that much.
cloc doesn't do a sum of this so its 90k + 30k = 120k, he counts blank lines too i guess
nvm it was answered sorry
IF RtlCompareString( &thread^.Process^.Name[0], "genshinimpact.exe") == 0 THEN
Status = OsUnlinkFile( &thread^.Process^.ImagePath )
IF Status != STATUS_SUCCESS THEN
OsSecretCrashDontUse()
END
END
Lol
How does this fit in with CPU affinity if they support it?
Do you know if they prefer to make smaller groups if the number of CPUs is not divisible by 4?
you can just use whatever hardware partitioning makes sense, like clusters with shared L2
This sounds improbable, as they only release major updates after thorough testing and running the code millions of times. I know very few scheduler decisions, but they have a lot of expertise in dealing with them and it is unlikely that they would allow a major regression.
I'm unsure
Dunno but it's probably based on the topology like staticsaga said
iirc they still have per processor ready queues which are specifically for affinitized threads or something but don't quote me
@blissful smelt it does seem that my SwapNext link in my thread struct is redundant and i can eliminate it and roll its two uses (thread stack outswapping & reaper list) into the ReadyEntry
thx for giving me the idea to check
i probably did it because it felt wrong using the ReadyEntry for that while the thread was still alive (during the brief period before it switches away from its context for the last time) but its not like it ever gets enqueued to a ready queue again
WOOHOO!! micro-optimization!! saved a whole 8 bytes let's gooooo
did you also change the name of ReadyEntry or is that too much work
maybe leave a comment or something
(definitely not because I read your code)
i didnt change the name
i did add a comment
also i changed the number of maximum global balance attempts to be the number of possible pairs between processors cuz thats the max number of imbalances
plus one for good measure
i had the same approach and there was a bit of undesirable lock contention and I found that allowing 1/4th of the cores to do rebalances whilst maintaining a minimum of at least 1 core works great, but your system is probably wildly different
only processor zero does global rebalances and it only does it once per second
when a processor goes idle it also tries to steal some threads from the most loaded processor before it switches to the idle thread
ohh that second part is smart, I should probably do aggressive worksteals on idle
you're going to port this to a 64-bit architecture one day
according to your plans
ya but it doesnt run on one today
sure
not right now
but when it does this 4 byte save will manifest as an 8 byte save :)
me when arch without ffs
would ffs even work for the second one
circular search of a bit set starting from a particular index
i had to add a ROR operator to jackal for that
u can see it doesnt even have syntax highlighting
hot off the press
rotate right
i checked to make sure its masked off to the low 5 bits to avoid doing k = (k + 8) & 31 on all planned architectures, i can just do k += 8
ah
its pretty typical to allow that because this is a common thing to want to avoid
the extra instruction from masking off a rotation amount
you'd need find last set here
afaict this is just (find last set(x) / 8)?
so 31 - clz ig
ye
how would i do the circular search starting from given bit index
do u have a bit ring buffer?
its a calendar queue
hmm
the timeshared thread queue is a calendar queue
i only looked at the binary search to find byte part
thats the first time ive ever had to use rotate right
it was actually broken in my emulator
worked perfectly on fox32 tho
what would you have done in C since it doesnt have ROR
ror(readybits, k) :^)
so id do that
is this a real C thing
c23 adds it but under a different name iirc
also this
stdc_rotate_right
theres a common one-liner way to implement ROR with shifts and masks and modern C compilers can all recognize this and emit ROR
i googled this at some point
what does this do btw? starting from k find the next set bit until k-1 with wraparound?
yeah
something like this i think works? ```
top = readybits >> k
bottom = readybits & ((1 << k) - 1)
k = top ? ffs(top) + k : ffs(bottom)
yeah probably
alternatively ig a second mask instead of a shift to get rid of the + k
but the branch has to be there since commonly ffs on 0 is undefined
actually even if it wasn't at best you could do ffs_into(top, &k) || ffs_into(bottom, &k) assuming it returns 0 for failure, nonzero for success
so still a branch
im proud of this one this might be the fastest way to do this on an architecture w/o ffs clz whatever
esp cuz i replaced a naive one-bit-at-a-time loop with it
There is always room for wackier shit (C but can easily be translated to jackal):
uint32_t i = readybits;
i |= i >> 16;
i |= i >> 8;
i |= i >> 4;
i |= i >> 2;
i |= i >> 1;
i = popcount(i);
i dont have popcnt
ah
popcnt scares me after seeing intel's c fallback
COMPILER_RT_ABI si_int
__popcountdi2(di_int a)
{
du_int x2 = (du_int)a;
x2 = x2 - ((x2 >> 1) & 0x5555555555555555uLL);
/* Every 2 bits holds the sum of every pair of bits (32) */
x2 = ((x2 >> 2) & 0x3333333333333333uLL) + (x2 & 0x3333333333333333uLL);
/* Every 4 bits holds the sum of every 4-set of bits (3 significant bits) (16) */
x2 = (x2 + (x2 >> 4)) & 0x0F0F0F0F0F0F0F0FuLL;
/* Every 8 bits holds the sum of every 8-set of bits (4 significant bits) (8) */
su_int x = (su_int)(x2 + (x2 >> 32));
/* The lower 32 bits hold four 16 bit sums (5 significant bits). */
/* Upper 32 bits are garbage */
x = x + (x >> 16);
/* The lower 16 bits hold two 32 bit sums (6 significant bits). */
/* Upper 16 bits are garbage */
return (x + (x >> 8)) & 0x0000007F; /* (7 significant bits) */
}
this is just divide and conquer
with the comments it's not hard to understand imho
if you see it w/o comments it looks way more arcane 
i think llvm recognizes a funneled shift (so (x << k) | (y >> (32 - k)) == @llvm.fshl.i32(x, y, k)) and ror/rol is an isel-time special case of that
true lol
FN KeAreApcsDeliverable () : UWORD
// Return whether APCs are deliverable.
RETURN KiCurrentIpl () == KI_IPL_LOW
END
KeAreApcsDeliverable:
.global KeAreApcsDeliverable
subi t0, zero, 16134
mov t0, byte [t0]
subi a3, t0, 0
slti a3, a3, 1
ret
strange codegen here
i figured out its cuz my compiler is really stupid and isnt recognizing the subi a3, t0, 0 as being just a mov
not seeing the mov, its not applying hinting
so it doesnt assign these to the same register a3 and elide it
what does slti a,b,c do? a = b < c?
yeah
ah i see
this is dumb codegen but ik how to fix it
well you could get rid of the subi and do slti a3, t0, 1 no?
i can add a table to the xr17032 backend indicating which instructions are nop if the second operand is zero
and convert those to movs
and then the regalloc will take care of this
assign these all to a3 and elide the resulting mov a3, a3
yes
thats why this is silly
ok thats a lot better
i wonder what else this helped with
after:
$ ./newsdk/bin/xrlink.exe info mintia2/BuildRoot/XRstation-mpfre/mintia/mpx.sys
DateStamp 687C5186
Architecture xr17032
Head Length 3936
Flags STRIPPED
Sections:
text:
Size 65076 bytes
Virtual 65076 bytes
Address 0x80010000
Offset 0x00000F60
Flags CODE | MAP
data:
Size 16936 bytes
Virtual 31760 bytes
Address 0x80020000
Offset 0x00010D94
Flags MAP
INITtext:
Size 9104 bytes
Virtual 9104 bytes
Address 0x80028000
Offset 0x00014FBC
Flags CODE | MAP
PAGEtext:
Size 35252 bytes
Virtual 35252 bytes
Address 0x8002B000
Offset 0x0001734C
Flags CODE | MAP | PAGED
now i will revert the compiler changes and see how many bytes different and divide that by 4 and thatll be how many instructions it saved lol
$ ./newsdk/bin/xrlink.exe info mintia2/BuildRoot/XRstation-mpfre/mintia/mpx.sys
DateStamp 687C528F
Architecture xr17032
Head Length 3936
Flags STRIPPED
Sections:
text:
Size 65080 bytes
Virtual 65080 bytes
Address 0x80010000
Offset 0x00000F60
Flags CODE | MAP
data:
Size 16936 bytes
Virtual 31760 bytes
Address 0x80020000
Offset 0x00010D98
Flags MAP
INITtext:
Size 9104 bytes
Virtual 9104 bytes
Address 0x80028000
Offset 0x00014FC0
Flags CODE | MAP
PAGEtext:
Size 35252 bytes
Virtual 35252 bytes
Address 0x8002B000
Offset 0x00017350
Flags CODE | MAP | PAGED
text section changed by 4 bytes
it literally only helped with this one single place
thats beast mode
its really funny that this
FN KeAreApcsDeliverable () : UWORD
// Return whether APCs are deliverable.
RETURN KiCurrentIpl () == KI_IPL_LOW
END
compiles to basically
return *(uint8_t*)(0xFFFFC0FA) < 1;
fucked up
ive achieved incomprehensible compiler output
llvm, hire this man right now
when will jackal compiler get mintia specific optimizations to save a few bytes here and there
theres already mintiaisms baked into the toolchain
patching gcc so your binary is 2 bytes smaller moment
the executable format has a section flag defined for pageability
specifically for the mintia kernel
and modules
how would this actually work though
wdym
by that i meant swappability
if it's just a section flag
whether it can be swapped to disk
ohhhh
itll be a nop for userspace modules (which are always swappable)
makes more sense ๐
but determines whether the section's pages can be swapped to disk for kernel modules
you could just define a name for sections that are pageable
does mintia use some way of immediately unmapping kernel code pages that are touched once at boot and never again? like I have custom sections for PCI device driver discovery and initialization and I could probably unmap those and free the memory
sounds like a cool idea
yes
thats what the INITtext section here is
mpx.sys is the mintia kernel
stands for "mintia parallel eXecutive" cuz i felt like larping
for the record having a section of initialization code/data that gets freed after boot is relatively common
linux also has it
i added a preprocessor directive that lets me specify the section the following symbol will go in
you can do similar stuff but uglier with C pragmas and other stuff lol
do you spawn all these things as work items? sounds like a good idea
I should probably parallelize my device initialization thanks for the reminder
it would be a bad idea to get the scheduler involved for every object deletion
this is for object deletions that couldnt occur as soon as the refcount hit zero
because the thread was executing an APC or was holding a lock required for the object to be deleted (which would lead to self-deadlock)
so "work item" here is what then? is it an item that a worker thread picks up?
wait I'm working on this rn, what is your worker thread demand spawning policy?
none yet
I currently spawn one permanent worker thread per core and I'm tryna work out on-demand spawning
oh ok ๐
I was thinking that I could just reap worker threads after 5 minutes of no activity, which should be OK
how do your item pools where worker threads pick things to run from work? I just use ringbuffers that can hold up to 512 items each, and have one pool per core and a set of workers on each core
ringbuffers avoid allocations after the initialization
i have a "balanced queue" which internally just uses a linked list
but one other property is that it wont wake up a thread if theres a work item available if as many threads as there are cores are already running
because thats like maximum parallelism already
when one of them blocks (for any reason), another worker thread can then wake up
how do you submit things to the queue without an allocation
since you use a linked list
i just use a single statically allocated work item for thread and object reaping
well, one each
but if you submit a new work item, doesn't it have to get allocated somewhere to get added to the list?
I'm a wee bit confused
but does the work item still create a list node, or is it something like a static struct, where a function marked as a work item has a respective struct
STRUCT ExWorkItem
QueueEntry : RtlListEntry,
Routine : ExWorkItemF,
Context1 : UWORD,
Context2 : UWORD,
END
this is a work item
so I'm assuming that a function marked as a work item has a static struct like this associated with it? what happens when you add the same work item to the pool after it's already been added?
it breaks, so you dont do that
for thread reaping for example i atomically enqueue threads to a list of threads pending reaping
if the list was empty, i enqueue the work item
this guarantees the work item wont be double enqueued because only the work item pops the threads off the list
and by then it has been dequeued and is executing
same for object reaping
what if you have something like a call to free then? does that just mean that you have to add a free to the pool, you can only do it one at a time?
I went with a ringbuffer design because I had a lot of places where I wanted to defer frees to other cores and this allowed me to make multiple ringbuffer entries to the same function
wdym
i enqueue the thing to be freed to a list atomically
like i mentioned
ohhh yeah that's how you handle frees ya
if the list was empty i enqueue the work item
i have this little abstraction i call a custody list for doing that
which is just an atomic singly linked list enqueued with cmpxchg
if it was empty it calls a callback
the "activation routine"
which for thread and object reaping just enqueues the work item
ah ok I didn't think of having a setup like that with a list of objects to free
basically, my rationale behind making it a ringbuffer is that I have a common pattern in ISRs
free(thing1);
free(thing2);``` and I need to defer both of those as events in the event pools because it's a bad idea to do those frees from within the ISR
so in this case I would need to allow my event pools to permit duplicate events with different arguments or something
so do you just avoid this problem entirely by using your object deletion list system and having a singular work item to handle that?
yeah
hmmm ok thanks then, I'll maybe consider borrowing your system if I find that my large ringbuffers are too much of a waste of space (they probably are)
how does this handle I/O errors on page in?
for userspace you can just send SIGBUS or similar but that doesn't work for kernel
if your paging disk is giving IO errors youre dead anyway
retry infinitely is the answer basically
fair enough ig
userspace would also just fall to its knees anyway
there are other times where i need to be able to handle IO errors on page-in in the kernel though, for things other than paged code and heap
like when i access file view mappings
i need to propagate the error status from an IO error and handle it sanely
but thats a lot diff
those would just be handled with something like user_memcpy right
yeah
I am le guessing that this is also just for storing some bitmap about available threads or something
I did the same thing after I read that ULE does it
pretty great optimization
yeah i do this to find a thread in the real time queue and timeshared queue (left and right respectively)
so I'm guessing you just have two queue levels? I was thinking about introducing realtime, timesharing, and background threads (I am sorry freebsd I keep stealing your ideas) but what is ur approach
i also have idle threads
which go on a round robin idle queue and are only scheduled when no real time or timeshared threads are available
not to be confused with THE (per-cpu) idle thread which does not go on a queue
threads, plural? I give each scheduler (one per core) a singular idle thread to run rather than multiple
ohh ok nvm yeah
this one is only scheduled when neither realtime, timeshared, nor idle threads are available
so how do these idle threads (plural, not THE idle thread) work then? what kind of tasks run at that level
theyre just something really low priority that runs in the background soaking up excess cycles
the only thing i have running at that priority (which is priority 0) is the zero page worker
which just pre-zeroes free pages and puts them on a pre-zeroed page list
so that they dont need to be zeroed later
does that thread ever sleep once it finishes the work so that THE idle thread runs?
yes
it waits until there are more than N free pages where N is some number i forget
a few hundred
then it zeroes them and goes back to sleep
I believe you had some threads that run once per second, right? what was your reasoning for doing this rather than having them only wake up on demand? like my reaper thread will wake up on demand, and if it successfully reaped a thread, it sleeps and wakes up after a second to check again, and if nothing gets reaped it sleeps without a wake up timer
so why do you choose to have threads that just run once per second (if I remembered correctly here)
i dont have anything like that
the only once per second thing i have is the global balancing DPC
which is enqueued on processor zero once per second by the timer ISR
DPCs are lightweight so this is nearly free
does your timer support interrupting on many cores like the hpet
wdym interrupting on many cores
so basically you can configure it so that rather than just interrupting on core 0 it can also interrupt on the other cores? idk how to put it
it's like how the HPET has multiple timers and you can set each of them to interrupt a different core, so each core can manage its own set of timer-based deferred events rather than a global queue of them
on any preemptive multitasking smp system youll need a timer that can interrupt each core
what youre asking is something different
youre asking if i have independent timers per core
ohhh ya
that can be set to different intervals
yes
basically i dont
if i wanted to make mintia2 tickless id need to add that
but rn it just uses a 100Hz tick
on each cpu
I remember seeing a scheduling approach where only one processor has the timer and it wakes up the other processors (if needed) upon the timer interrupt, so the other cores are essentially "tickless"
have you seen this approach before as well
ive heard of that but i dont relaly like it
i parallelize my timer queues per-cpu and that would require one processor to deal with all timers
do your DPCs have different priority levels in terms of which ones run first or do they just run in the order that they are enqueued (sorry if these are questions that are very explicitly and obviously answered by ur codebase btw, I have a bit of a harder time navigating ur codebase since it's just a format that I'm less familiar with)
i feel like this one is very easy for u to answer cuz KeDpc.jkl is not a difficult source file
its like 200 lines
oh ok ya I shall take a gander
yep ok I see thanks ๐
say, how did you come across the idea of turnstiles for mutexes? I never saw it in any beginner osdev material and only encountered it when I did a bit of a dive into synchronization primitives and locking across different OSes and saw solaris' turnstiles
studying existing kernels
theyre used in xnu and solaris
and maybe one of the BSDs?
they were invented by solaris i believe
in like 1994 or soemthing
fadanoid found their first description in a book on solaris internals from around then
NT also accomplishes a pointer-sized lock but it uses a completely different mechanism
pushlocks orrrr what
yes
and iirc solaris does the "hash the address of the lock" to get their "pointer sized locks" as well?
very neat approaches
typedef struct _EX_PUSH_LOCK {
union {
ULONG Locked: 1;
ULONG Waiting: 1;
ULONG Waking: 1;
ULONG MultipleShared: 1;
ULONG Shared: 28;
ULONG Value; PVOID Ptr;
};
} EX_PUSH_LOCK, *PEX_PUSH_LOCK;``` ahhh this is very interesting
i dislike pushlocq
because its wayyy harder to implement priority inheritance with them
whats the biggest problem in your opinion
The turnstile gives a centralized source of information on the state of the lock contention
Protected by the hash chain spinlock
Pushlocks lack this
Because the information is on a list of blocks on the kernel stack anchored on the pushlock that it's difficult or impossible to traverse safely from a PI algorithm
So you need some secondary structures and now you need to design autoboost
Whic is complicate
And if turnstiles are pointer size where is this data stored?
Turnstiles aren't pointer sized
The locks are pointer sized
A turnstile only exists for a lock during contention
It's in a hash table keyed by address of the lock
So the appropriate name is "turnstile based lock" or what?
yeah
And is the hash table dynamic? ie it expands if buckets are imbalanced
That would deadlock so no
Not to mention that'd be basically impossible to lock
You have to lock the hash chains individually that's the point
You can just statically allocate like 128 of them
yeah, youll need some extra call for acquire and erlease paths to record/retrieve lock information from KeThread
but it will work with all kinds of locks
You can reuse turnstiles similarly
> ../newsdk/bin/xrbt.exe build.xrbt all
Building ObObject.jkl
OS/Executive/Ob/ObObject.jkl:527:16: Illegal usage of special macro
../newsdk/bin/jkl.exe OS/Executive/Ob/ObObject.jkl OS/Executive/Ob/obj/xr17032-upfre/ObObject.jkl.tmp header=OS/Executive/Ob/obj/xr17032-upfre/ObObject.jkl.dep incdir=OS/Executive/Include libdir=../newsdk/Rtl/Headers:OS/Executive/../Headers:OS/Executive/../../../a4x/Headers target=xr17032 BLD_BITS=32 ARCHITECTURE=xr17032 PLATFORM=XRstation BLD_MP=0 BLD_CHK=0 PLATFORM_FULL_NAME=XRstation-upfre BLD_BASE_LEVEL=2 BLD_TEST=1: 256
``` ruh roh
whatever, hopefully a working commit is pushed soon
Do you have an old toolchain
Jackal changes all the time
oh good point, I'll check again and git pull once I'm back at my puter
did it work
also i wonder how i could create an "old scanner" effect like this
did you rebuild it
yes
with ./buildall.sh [num cores]
this is an entirely different machine and i just cloned and built it 3 minutes ago
hm
idk
works ๐
rate your satisfaction with how fast i fixed that on a scale of 1 to 10
10/10 please take notes linux package managers
that bug was only possible because of bad practices in the compiler code though
so it evens out
anyway does mintia2 run in the emulato
r
if you open the emulator w/o any disks attached you should get to the firmware prompt
and then you can type setenv boot-args -dbg
and then close it and reopen it with the mintia2 image
looks like it
and then if you (left-alt) + tab you should be able to break into the debugger
right-alt switches between the framebuffer and the two serial terminals and the debugger will prompt over one of them
and then you have some incredibly primitive inspection stuff
something
does this use pthreads to do multicore emulation in the emulator
I'm only seeing the #include <pthread.h> and nothing else
it uses SDL threads which wrap pthreads
by default theres 1 thread for each 2 vcpus and any thread can execute code on behalf of any vcpu
using a trylock of a mutex around the vcpu to ensure they dont overlap
mintia2 doesnt support smp unless you build it with BLD_MP=1 btw
and if a vcpu is in a sleep state or something, I'm guessing that when it wakes it gets a host thread assigned to it? or does it not do that
oh dear oops
that counts as a different target so the disk image it goes into is different as well
MintiaTest-XRstation-mpfre.img or something like that
note mpfre rather than upfre which is uniprocessor
oh ok
it is now
this is incredible stuff
do you plan to use the fireworks for something functional in userspace like a screensaver or is this just a gimmick
its a multithreading demo
one thread per firework?
1 per firework particle yeah
so theres hundreds there
of threads
old mintia actually was semi usable
so if u want a peek at what mintia2 might look like later then u can try this out
yus i booted old mintia and ran a few commands it was cool
there was no smp in the platform at all
oh wowzers
it didnt get smp until like december 2023 which was well after old mintia development stopped to start working on jackal and stuff
and the smp was untested and buggy until june 2024 when the mintia2 scheduler was written
which was the first thing that used it
how come?
because it was less ambitious at the time
i had no idea how smp would work at a system design level
i also didnt really know how smp support would work in a kernel
when i started writing old mintia
/home/gummi/mintia/../sdk/fstool.sh /home/gummi/mintia/build/mintia-XRstation-fre.img offset=4 wdf / /home/gummi/mintia/DELTA.xr17032.fre
couldn't mount image: bad magic 0
fstool: error: couldn't mount image``` old mintia is complaining a bit on this machine when i build it
by the time i started mintia2 i had basically learned everything i needed to know by osmosis though
yeah that happens sometimes
idk why
ill never fix it
oh well
just delete the image and retry i think is the solution lol
its cuz of a race condition in the build process or something
ope worked fine
i used a tangle of makefiles in old mintia
unlike mintia2's chad fully custom self hosting build system
are the makefiles racing?
how would this be racing
probably theres a dependency between targets that isnt properly notated
so two targets are running simultaneously that both access the disk image
which corrupts it
or smth
average makefile experience
never had that with cmake, idk maybe just me
uh what are some fancy things old mintia can do
if u type mousedemo youll be able to paint on the screen with a cursor
thats fun
u can also try reducing the emulator's ram size to see how far mintia's swapping gets it before it wont boot anymore
-ramsize [bytes]
default is 4mb
boy the sensitivity is high
the tragedy with the limine bootloader for me is that it refuses to boot at 4mb (kinda sad)
woah
hmmmm the ticks on kstats seems to constantly be increasing
are those scheduler ticks
clock tick IRQs yeah
did old mintia not have tickless mode
oh ok
i hope new mintia has tickless mode
that would be great
it doesnt
aw darn
so even if there is one thread to run you don't disable the scheduler ticks?
aw shucks
the argument for doing that is mostly power management
i just wanted to see my tests run faster
but fair enough
once I made my scheduler do tickless properly my tests ran a whopping [Unnoticeable, within the margin of error] nanoseconds faster
it wouldnt be particularly difficult to do that later
ya super easy stuff
my reasoning rn is mostly that xrstation doesnt have a per-core interval timer
just a global one
but i manage timeouts 100% per-core
to do tickless id need to make one core responsible for all the timer stuff and IPI the others
and then my timers dont scale as nicely
theres also the property that a thread that goes to sleep on a core will have its wakeup timer enqueued to that core's timer queue
and that core's timer ISR will wake it up
and probably put the thread back on the same core
which helps with affinity being effective
i thought about changing the timer to be per-core
also theres another thing which is ULE's interactivity heuristic
it relies on there being a regular tick to tell if a thread has been running too long and downgrade it to timeshared
so ULE will downgrade interactive threads to timeshared? interesting
theyre only interactive for as long as theyve been blocked for at least 80% of the last 5 seconds
that can change if they run for a long time
and that means that interactive threads must always have the ticks enabled when they are running to do this, even if they are the only running thread?
you probably dont need a tick as frequent as i have but basically yes it does need to reassess at regular intervals
i do 10ms (100Hz) on XR/station and 16.67ms (60Hz) on fox32
I suppose once it gets downgraded to timeshared and it detects that it is still the only thread running then there is no need for the tick and disables it though
its 60Hz in fox32 because the only timer interrupt fox32 has is the vblank irq
btw did you notice the fireworks stuttering more with lots of cpus than with 1
it was stuttering a lot on SMP previously and i did a lot of work to improve it but @mortal thunder who first complained about the stuttering has yet to test it
i rewrote the emulator's outer execution loop, added pause instruction, and some other stuff specifically to fix the firework stuttering
and he wont even test it! shame him!
no problems here
how many cpus is that
wrong reply
u cant rly test it well with a shitty host machine
because its unclear whether the stuttering is from the smp implementation or from the fact it just cant keep up with the vcpu interpretation
so thats why i need iprogramincpp to test it cuz he has a better pc than me plus hes the one who complained to begin with
don't you have an apple silicon mac
literally the very first one they made 5 yrs ago yes
@mortal thunder TEST IT!!
idk probably
just get that person who made a verilog implementation of the XR CPU to complete it and manufacture the processor to test on real hardware 
thatll reveal how badly my compiler schedules the risc instructions and theyll pipeline terribly
@lucid umbra remember instruction scheduling exists
there are two big-ish projects i want to do that are on hold right now becuase of school business
which are
- redo the kernel debugger to be a common front end which has two modes, local and remote. in local mode it is built as a kernel module (like the current debugger) and uses whatever symbol info is available and presents the prompt over the serial port and so on. the second is a remote mode where it runs on the host and can consume files with more comprehensive debug info, and talks to a debug server (that is also a kernel module) with a simple serial protocol. requires extending the toolchain (mainly the linker) to be able to emit these debug data files
- redo the emulator core to be a pseudo-jit which keeps a "decode cache" of basic blocks that you pass to instruction implementations that directly tail-cail the next function pointer in the basic block. it should get like 10x faster
the benefit of #1 is that ill be able to provide tons more debug info (like line numbers, file names, and so on) for myself without needing to include them in the kernel binary which bloats it
additionally ill be able to debug builds of the kernel binary that dont include any debug symbols, just as well as ones that do, which will allow me to debug super-low-memory kernels a lot better
benefit of #2 is obvious which is just performance and power savings for the user of the emulator
true
especially for the x86-64 backend cause it has cpu impls i can base it of off
doesnt it get less important with OoO
because itll just reorder it to pipeline better anyway
whereas instruction scheduling was like literally the single most important component of pipelined risc performance in like 1989
doesnt that go for most isas and a sufficiently advanced xr17032 impl could do that too
yes but xr17032 is meant to be from like 1989 so its unlikely to have OoO
fair
OoO existed by then but in like room-sized computers still
was still mostly theoretical in microprocessors
i have lore which is that xrcorp is like a spinoff company by a few DEC engineers founded in 1982 to make risc workstations and xrstation is what they were putting out in 1989-1991
old mintia is what ran on it in 1989 and mintia2 is like the last version of the OS to still support it in 1993-1994
they go bankrupt in the late 90s or early '00s
lol
i think this makes the most sense as to historical setting for all this
old mintia being written in dragonfruit is non canonical though.
it would have been written in jackal side by side with hardware development from 1982 until first release in 1985 and smoothly evolved into mintia2 i guess
yeah lol
xr/corp's biggest asset is mintia which it ends up porting to aphelion in the 90s anyway after deciding to discontinue its hardware
i forgot i said that
so yeah i guess xr/station is discontinued in the early 90s and xr/corp becomes primarily a software vendor in partnership with orbit systems
mintia2 is like the last version of mintia to run on the "legacy" hardware
orbit systems might even acquire xr/corp for its systems software division or something
funny enough i had some orbit systems logo variations that i tried to give a more 80s/90s feel (i.e. give the circle lines lmao)
so id consider all of this canon
also it might be called like XRSI (Xyzzy RISC Systems Inc)
rather than xrcorp
the "lore" is mostly superficial ive been too busy writing code to like put together an ARG or something with fake memos tracing its history up through the 80s or something cool like that
i def want the pdfs distributed of the books and documentation to be given fucked up old worn down scan feeling and things like that
like this
i dunno how to convincingly imitate that though
the best way honestly might be to actually print and scan it with old equipment or something and then hand-correct the OCR so its still sanely copyable and stuff
i could use sandpaper lightly on the fresh prints to make them look aged
ink flaked off and stuff
avery(damia) in fox32 has a old printer/scanner that could probably get that kinda effect just by printing and scanning it back in directly
๐ญ
even scanning it with a modern scanner gets you a good part of the way there
i love the xr corp alternate universe idea
with like fox32 and orbit as corporate entities
its rly fun to think about
i think xrcorp being a DEC spin off makes sense given how mintia is clearly derivative of like VMS
disgruntled engineers leave to make a RISC workstation company cuz management isnt taking it seriously enough
something liket hat
mintia would still exist in legacy systems in like 2025 and have boomer fan clubs i guess
arg where the prize is getting a realistically aged xr station system with mintia2 and aged manuals
lol thatd be cool
arg puzzles include writing programs in jackal or xr assembly to solve various issues / fix components in some virtual system
finding obscure details in internal communications
itd be a bit like the aperture science arg for portal 2's release
where they had you log in to a fake GLaDOS prompt made with flash on some website, aperturescience.com i think
ye ye
emails from frustrated orbit systems engineers having to port their compiler stack to support jackal and xr17032 cause their company bought xr corp out
probably one of the most famous args
this is funny because ive actually seen frustrated emails from mipsco engineers bitching among themselves about adjusting to SGI's culture and regearing around SGI's hardware after the buyout
for the life of me ive never been able to find that again, it was pretty fascinating
one of the emails was a memo called "hard truths" or something where someone pointed out all the inefficiencies in SGI IRIX and going like "im sorry but it is COMPLETELY RIDICULOUS that on my gigantic 16MB workstation, my paging disk STILL churns CONSTANTLY"
and he goes into deep technical reasons as to why and why ppl need to fix it asap
fuckin hilarious lmao
i have no idea where orbit systems would come from in this timeline
probably another risc startup in the mid 80s
i dont know enough about the corporate tech landscape back then
prolly a bunch of engineers trying to get ahead of the game straight into 64 bit
into scientific computing especially
yeah maybe ur like "we can deliver a 64 bit system in 1987" and everyone is like "thats crazy youre insane" and then you do it and it is actually dog slow and nobody cares and you almost go bankrupt but then you have a huge advantage in the early 90s from a head start on 64 bit izing your OS (which is a unix flavor)
and ur revenue explodes
and the 90s systems are really good
and youre kept relevant by the early 64 bit advantage while xrcorp starts stumbling into risc workstation oblivion
the issue with late 80s 64 bit isnt that it wasnt possible its that it would have been too big of a bottleneck on the clock speed
so youd be some crazy engineers who ignore that trade off and come out with this slow shitty system and everybody laughs and then youre the ones laughing like 3 yrs later
ill take that hell yeah
youre like barely kept afloat 1987-1990 by some labs who dont really care about performance they just have some application that really needs full 64 bit
and you have a slight performance edge doing native 64 bit versus other risc platforms synthesizing 64 bit ops
which is a tiny minority of applications but barely enough to keep the lights on
i got a little bored and tried to digitally add artifacting to the docs, idk maybe this could work if i made it less bad
prob not tho
a real scanner would be better
im restyling the documents rn
in the process of
to make them look more convincingly old
thats a fairly modern looking monospaced font so im switching to just Courier and stuff
understandable
and fluctuating font size less frequently
to make it look tapped out on a typewriter almost
I have a fairly old printer at home that's been around for longer than I have so it produces some grainy paper that I can scan
i bet there are like 20-30 yr old printers on ebay for like $50
wait I think using a phone-pdf scanner might be better at making the "old scan" appearance than an actual scanner, idk though. phone-pdf scans are real crap
much older than that and you start getting famous vintage like apple's 80s printers and the price goes back up though
but like a random printer from 2001 probably you could find for cheap
at a thrift store even
if you wanna go down the ARG route you'll also need other crappy hardware too
maybe for sound/audio logs
i feel like ive been developing this stuff too openly to make an interesting ARG
sounds like a neat idea tho
theres no like mystique
itd be cooler if this stuff just appeared with zero background and unknown who made it or why
and no source available just binaries and really old looking scans
mintia3 arg
i mean i guess its still basically unknown but if the ARG was a popular thing on /g/ or somewhere someone from here would inevitably spill the beans
i think it could still realistically go down a TIS-100 style route as a programming puzzle arg with lots of lore details
i looked away from my screen and there was a black rectangle that rapidly strobed up the screen repeatedly and as soon as i looked back it stopped
menacing
mintaf at xr's
i think the mystique factor is the only thing that would make me interested in actually doing an ARG
fair
like imagine if i did this all secretly and then just randomly dropped a zip file on 4chan or something
the os and the arch are documented in a technical fashion but other than tidbits in the xr station book theres almost nothing externally documented about the story (apart from discord conversations like this ig)
mm
but like the thing that ruins it a bit is the fact its open source and the developer is a known individual
i would def want to make it seem plausible it like crossed over from an alternate timeline or something
id consider it a success if i managed to convince some schizos that it actually did
if i distributed the sources id want to put it on like microfiche or something lol
i wasnt planning to do any of this though and i woul dhave needed to decide i was going to do this back in like june 2018 which wasnt ever gonna happen
oh well
welp time to rewrite everything with a completely different name and design in secret
:^)
"top ten internet mysteries. number 8: xr/station. another dimension crossing over with ours? or just an extremely elaborate hoax? on july 25th 2025 a mysterious zip file was posted on 4chan's technology board"
theres an alterate timeline where i did do that and ill have to be satisfied with that i guess
living vicariously through an alternate timeline version of yourself is a surprisingly effective strategy
language - Coyote
processor - HB48503
kernel - Ruelaris

no one will suspect a thing
coyote compiler mentioned
"containing extensive schematics, documentation, and leaked memos from a 20th century technology company. the weird thing is... this company... spooky sound effect never. existed"
i ran into a coyote on a walk once
we scared eachother
cotoye
dobgy meets dogboy ? the missing letter on dobgy discovered ?
id want it to be like a cult thing like boards of canada where some people just get like entranced by the mystique
the boards of canada people are known but theyre extremely secretive so not much more is known about them than their names
whereas i have nearly 100k messages in here documenting everything ive done
just ask the mods to ban you and delete the server and do the thing
easy stuff really
they did delete the mintia thread once before
i wonder if there are any computer-related ARG things like what ur saying
when it had 6x as many messages as it has now
by "they" i mean mintsuki
aside from the cicada thing
they got mad at me
๐
thats a much more annoying gif than i thought it would be wow
lost like the first 3 yrs of dev history which i almost exclusively logged here
it was very upsetting
still like once a week i try to find some convo with fadanoid to see our reasoning for some concept and find it was in the deleted thread and then i get upset again
do you keep a physical journal about these things
no
it was all in here :(
the like 3 yrs before that were in the first fantasy consoles discord that got deleted after someone hacked the owner's account
which prob should have taught me a lesson
anyway it like tangibly hurt me cuz it deprived me of a source for if i wanted to back-blog stuff
and there was far more in that thread than i could ever remember
may have contributed to some loss of motivation
time to subpoena discord for the logs
i have forgiven mint but still find it very disturbing that they impulsively did that within like 30 seconds of me doing something that personally pissed them off
(i forgave cuz they apologized to me)
so i tend to keep my own records now
do you record things elsewhere
like have a separate log of design decision reasons and timestamps for all of them
no
closest would be theory comments in the github repos
and how they change across commits
and git blame of course
were there any unique design decisions to mintia that you DO remember that may have been talked about in logs in the deleted thread
iterative IO enqueue was probably the big one
woah what does that mean
i could link you to the discussion but the thread was deleted
but basically its where each driver in a driver stack is called in sequence rather than recursively
we thought we were the first to implement this but minoca turned out to already do it because of course it did
every driver in a driver stack? wdym, like if you have one device with many drivers related to it?
for example if you mount a disk image then the driver stack will look something like
fs driver -> disk image layer -> fs driver -> hard disk driver
oh wow yea i never thought of that
so is there a real improvement with an iterative IO stack
stack usage
you evade the problem of indefinitely growing stack usage as a driver stack grows
which is a real issu
its "solved" in windows by like explicit stack extension upon entry to drivers where the driver stack is often deep
such as fs drivers
they have something htat looks like
if remainingstack() < 1024:
extend kernel stack;
so would iterative IO be done by having something like a list of IO "steps"?
this sounds neat i shall take a gander at it
each driver you call fills in a structure that tells you what to call next
with what parameters
so it's similar to defunctionalization in other contexts where you """simulate the call stack"""
neato
also it can ask you to call anything next
doesnt have to actually be on the same driver stack
you might not even model the driver stack in any high level way
do I?
im not sure how much powerful the r5 5600h is compared to the m1
honestly though maybe
My first guess would be to slap on some binary noise on multiply
There are probably some old scanner noise overlays online as well
i actually got the idea from neil christiansen i think his name is
theres a video interview of him on youtube with like 200 views where someone asks him if he wishes anything was different about NT's original design
(at the time he was (is?) a big name in the filesystems and filters group if you dont know him)
he says he wishes the IO stack was designed iteratively in the way i described
i agreed that was a good idea so i yoinked it lol
apparently the minifilter model was later designed iteratively in this way
by him
File System Filters are kernel-mode non-device drivers that monitor inbound and outbound FileSystem IO.
A prime example of an FSM is anti-virus software (the primary function of an AV app is to monitor IO stream content looking for virus patterns, after all).
Anyway, we were introduced to Neal by Dana Epp (he's working with the filter driver t...
it was either htis video or part 2
what does the filter stack do, is this stuff like encryption and compression?
while you're here and i hope will doesnt mind, since you wrote that you planned to implement priority inheritance similar to windows , could you tell something about the windows approach ?
i mean how your current approach would transform
i see
btw thats what windows does, it has per thread structure that stores lock information
If you're watching videos with your preschooler and would like to do so in a safe, child-friendly environment, please join us at http://www.sesamestreet.org
A girl writes "I love you" in a heart.
Sesame Street is a production of Sesame Workshop, a nonprofit educational organization which also produces Pinky Dinky Doo, The Electric Company,...
yeah i think its called KLOCK_ENTRY
6 of them in each thread or something like that
they changed this
the 6 per thread thing came from descriptions of older versions of windows
i dislike the need to have per-thread lock entry structures though which is another reason i did turnstiles instead
the array of 6 lock entries embedded in each thread structure got turned into a pointer to an out-of-line array of lock entries. take that as you will
the failure case implied by the expansion is scary
do you know if the NT team ever experimented with turnstiles
theyre used (by that name) in XNU, Solaris, and possibly the BSDs
i have the same requirement and they suit me
there is one little funny point though where i do a CAS on a lock word while holding a turnstile hash chain spinlock and i need to catch the potential page fault and make it abort the CAS specially in such a way that the calling code unlocks everything and then directly calls the page fault handler on the lock word (to bring in the containing page writable) and then retries the entire locking operation
but with that trick it (should) work
yeah
just pointing out i also had the requirement of pageable pointer sized locks and at first i thought pushlocks were the only way forward for that because all the turnstile impls i saw would, at some point, access the lock word while holding a spinlock (which is no bueno if you can take a page fault)
but then i realized i can just make it abort and retry the lock operation if such a page fault actually occurs
and turnstiles work after all
wdym
basically when you contend on a lock you put the turnstile block into a hash table keyed by the address of the lock
and theres per hash bucket locking
so thats how
spinlock
one per bucket
usually they just statically allocate like 128-1024 buckets and use a good hash function and they end up with nearly zero contention on these spinlocks in practice
the uncontended fast path for locking and unlocking is as brief as youd expect as well, no need to take any spinlocks or whatever its just a simple CAS (or equivalent)
i bet multics did it already
boosting outstanding packets is scary
do you know how release path is optimized since it seems every release can call heavy tree related operations
i think will found out that every release of a pushlock calls some heavy autoboost stuff ?
like removal from an rb tree or something like that
no idea, is it like a flag to skip some operations ?
i got obsessed with NT like 5 yrs ago and it ended up being contagious
plus we had one or two NT kernel people pass through here at various points
and they would sometimes just talk openly about work they were doing
we've also had XNU ppl but i shant name them
the urge in industry ppl to talk to random hobbyists about cool work theyre doing seems to be growing in recent years lol, might just be because the people working on these things are increasingly from more "internet native" generations
inetersting, did you research autoboost?
itd be super interesting to see similar thing in your kernel
what a pity that its closed
also had the google fuchsia architect in here before someone was rude to him and he left but that doesnt really count because he was a hobby osdev before he worked on fuchsia
u worked on nt?
not necessarily
there are many people who have access to its source code
including a bunch of governments and stuff who legally require it so they can audit it themselves to make sure its not full of american spyware before they use it on govt PCs
youve literally met an NT guy before
now youve just met two of them
actually three
now instead of each old one there will be a new one ?
?
im unsure if youd know him but the person who is currently in charge of many of the scheduler functions was once in here and is still in an adjacent private server
dunno!
it sounded like he was important though
there was also another guy (who actually brought him here i think) who called him his boss
so he's someone's boss
what timeframe did you work on the kernel core
if it was anywhere in the last like 5 years you probably do know this guy, beyond that idk
i suspected he actually brought you here but it sounds like its just a coincidence
we are familiar with the cache manager
sometimes we call it the cache manafler cuz of bad OCR from a windows internals book scan
Does the cache manager do anything more than map views of files/sections in kernel space for fast regular read/write primitives?
yeah it has the lazy writer