« first day (3552 days earlier)      last day (1379 days later) » 

2:19 AM
Always be on the moral high ground, unless your share of the pie is compromised, then just be your true self. </sarcasm>
 
 
2 hours later…
user7659542
4:43 AM
@nwp is that possible to make? If it was all static/ynamic code analyzers would have it
 
user7659542
that sounds like something which is extremely difficult to develop
 
7:54 AM
Hows everybody doing?
 
user7659542
@Mikhail alive
 
user7659542
100 upvotes on that post but still no real answer, lol:
 
The real answer is that the printed record lags some number of years behind the state of kernel development, and you should first learn whatever is outdated
At least for Windows kernel development, I haven't found too many breaking changes.
 
user7659542
easier said than done. You'll read an old book, go look in the current kernel see how people do things and realize it is totally different. So what you ll be looking at in the kernel may not even be relevant at that point
 
7:59 AM
Admittedly I've only written Linux drivers as part of a class, and my Windows drivers didn't get signed :-)
Not really, I mean there are so many source code examples that work fine.
 
user7659542
But even then when reading old code, you very often wonder why they did certain things
 
user7659542
without some clear documentation or explanation sometimes it is difficult to know whether what has been coded is "artistic freedom" or because the kernel requires it to be that way
 
That doesn't sound like a task oriented approach. I mean, when I needed to bring a bunch of high voltage low latency crap online I just started writing and got my work done. You're looking for mentorship which I doubt anybody is willing to provide without a business case, and is probably hard to find anyways.
 
user7659542
@Mikhail not necessarily mentorship, just clear structured explanation. When I first started using Linux I read that book:
 
user7659542
 
user7659542
8:05 AM
I read it a couple of times and now I feel quite comfortable using POSIX, researching POSIX stuff and so on and so forth
 
user7659542
with kernel dev the books I found are outdated and do not explain things very well IMO
 
8:33 AM
It certainly can feel they start in the middle of things. I think kids these days learn Linux after they've played with their university's toy operating system.
This is certainly our curriculum
I mean, our school had you building a pipelined CPU in (tor)Mentor Graphics before optional writing an kernel driver.
On the other hand writing a modifying a parallel port driver to do what I wanted was pretty straightforward.
Working with Linus would probably be hell. The guy blames other people for his own failures. A good example of where this killed a company was with transmeta. Dude was like "it runs great in Linux" and Windows 98 just needs to catch up!
Not to mention he believes RAII is for the weak.
 
there are arguments to be made against RAII
especially in a place where excessive allocations are not good™
 
Nope, your thinking of something other than RAII, which perhaps is called allocation.
 
when available RAII will encourage many small allocations and an OOPy object graph with many indirections
2
in a project with as many contributors as the linux kernel you don't want to keep educating people to avoid that kind of shit
same way that having malloc available encourages just allocating instead of actually considering the lifetime and usage of the memory you need to allocate
 
 
1 hour later…
nwp
10:07 AM
@traducerad There are many approaches. All of them have significant drawbacks. But basically you can put Rust-like rules into C++ that prevent data races and static analysis can help enforce the rules. The cost is that you loose expressiveness and there are other drawbacks which makes this not as great a win as it first seems. I spent my thesis on that.
 
 
3 hours later…
user1804599
12:45 PM
You should encourage lazy evaluation and streaming of data to avoid allocations. Neither C not C++ are good at this in any way. They’re terrible at it.
 
user1804599
Combine this with an annotation that you can put on functions to guarantee they won’t allocate, and now you have a language ideal for low-allocation situations.
 
@rightfold I thought there was discussions of a [[pure]] attribute which deals with part of that
 
@rightfold no the correct thing to do is to consider your needed allocations and preallocate them in a single bunch and subdivide out of that. Sometimes you just need 16 MB but that memory shouldn't be in half a million separate allocations
 
 
4 hours later…
4:49 PM
@ratchetfreak I'm tempted to give this a "star of shame". It's complete nonsense.
3
 
 
2 hours later…
6:28 PM
@ratchetfreak Have you ever looked at the source code for a normal heap allocator, such as what's used by malloc or ::new?
 
 
3 hours later…
9:28 PM
@ratchetfreak You're mistaken. I've been able to greatly reduce the number of allocations in several projects by introducing RAII.
 
@ratchetfreak so... that's actually what the linux kernel says to do because kernel stack sizes are small
 
10:17 PM
@rightfold I've always had this feel but wasn't really able to distill it down to an specific example. Do you have one? I suspect that part of the advantage of lazy evaluation was that ability to optimize the evaluations, so that if you had C=A+B-A you could optimize it to C=B. Although perhaps this is ancillary to what you were thinking about.
 
@Mikhail I suspect at least part of what he's talking about is simply avoiding copying by getting data into memory and doing all the work with it in-place, then recycling the storage when nobody needs it any more. C++ tends to make that fairly difficult to manage (at best). As for your example, although the code to do so can get ugly, you can do things like that with expression templates if you want to (but it's usually only worthwhile when the operations are fairly expensive).
 
user1804599
10:36 PM
@Mikhail Performing arithmetic using lazy evaluation usually amounts to using Peano numerals which is very inefficient.
 
user1804599
Example language which makes it easy to avoid allocations but has great support for ranges: D.
 
11:14 PM
Is any part of a std::unique_ptr instance (the object itself, not the target it points to) heap-allocated under normal circumstances? I'm asking because I want to know if it leaks anything when the stack frame is popped for abnormal reasons.
It's just a pointer stored in automatic-memory right and doesn't do anything screwy?
 
11:32 PM
@kevinlawler No, normally nothing that's heap-allocated. What's stored is normally a pointer to the specified type of object, plus a deleter (both typically stored in the unique_ptr object itself).
 

« first day (3552 days earlier)      last day (1379 days later) »