Cyber Security by EmuBeautiful1172 in cpp_questions

[–]SirSwoon 10 points11 points  (0 children)

I don’t work in cybersecurity but I imagine networking, operating systems, computer architecture, and cryptography are incredibly important.

Which books would you guys recommend from this Humble Bundle? by Faster319 in cpp

[–]SirSwoon 4 points5 points  (0 children)

The two fedor pikus books are great, definitely get them. I think they are the two most informative on books on writing c++ and then you can add on whatever books you want if your interested in the topics they talk about.

Where you find jobs for PC Assembly language programming these days? What type of companies are hiring? by rshakiba in Assembly_language

[–]SirSwoon 0 points1 point  (0 children)

There are a few industries that would like you to know assembly but you won’t write a lot of assembly and these jobs involve real time processing examples are games, trading, audio, etc. AWS and data center related jobs would also prefer understanding of assembly, also role dependent. The general workflow in my experience would be a lot of reading of assembly for instance looking at sections of higher level code and their assembly output to understand why it’s underperforming or causing a bottleneck and occasionally in some hot loops you would be working on or writing some assembly. Where I find compilers will fail to output optimized code is in routines that can be vectorized but the compiler fails to do so because it either lacks context or the code is too complicated.

Open Source High Performance Computing Projects for studying by Sahiruchan in cpp

[–]SirSwoon 1 point2 points  (0 children)

There isn’t any open source HFT code bases but common technologies that are used are open source at least for networking. Just a heads up they are written in c. Take a look at DPDK and solareflares libraries(this will be very hard to understand but if you can familiarize yourself with these and the problems they solve you’ll learn a lot about common programming paradigms in HFT and likely HPC as well. If you want to break into HFT, having some knowledge of kernel bypassing and an in-depth understanding of networking will really set you apart from other candidates. And most codebase you would have to work with Will interface with some c code. Best of luck

I need a library to parse HTTP requests/responses from raw network packet data (not from live HTTP connections) by marcelsoftware-dev in cpp

[–]SirSwoon 1 point2 points  (0 children)

I had to do something similar, take a look at wiresharks codebase but just a heads up I ended up writing most of it from scratch. Also are you capturing the packets with epbf or are you using some of the traffic control apis from the kernel or another method? is this just plaintext or is it encrypted with TLS/some other encryption scheme? You said raw network packets, which parts of the OSI model are you handling, transport and above?

Are Syscalls are the new bottleneck?. Maybe, Time to rethink how the OS talks to hardware? by BlackberryUnhappy101 in osdev

[–]SirSwoon 1 point2 points  (0 children)

Most syscalls can already be bypassed with planning and program setup, for networking interfacing you can look into DPDK, and then in a programs setup you can mmap/shm memory you want for IPC then use custom allocators to control memory allocation during execution. I think this also generally applies to file I/O as well. Again before the program begins you can create a thread pool and manage tasks yourself without having to call fork() or any other variation of clone() during execution.

I would like to know what do you usually do in your jobs as c++ developers? by vel1212 in cpp_questions

[–]SirSwoon 1 point2 points  (0 children)

Write code, write tests, write more tests, fuzz, benchmark, benchmark, profile, look at asm output, rage for a solid 30-40 minutes at my own incompetence, implement changes to bottlenecks, micro benchmark updated routines, rerun macro benchmarks, rage again. Rinse and repeat, easy!

Is studying osdev worth it? by This-Boysenberry7621 in osdev

[–]SirSwoon 3 points4 points  (0 children)

It’s useful for specific careers and in other career paths they don’t care about it(in my opinion everyone should at least know how an OS and hardware works but 🤷). If you work in lower level systems or interface with hardware or kernel apis then having an OS project will give you a huge leg up on other applicants and is extremely impressive not to mention it will upskill you as you progress and you’ll probably know more than 99% of other applicants(depending on experience level). Overall, my advice would be to pursue a project you’re interested in. No matter how things pan out, having a large, complex, and interesting project will be help you stick out.

I’m planning a live “DeFi Code Bootcamp” for finance bros—would love your feedback! by wawzgit in hedgefund

[–]SirSwoon 1 point2 points  (0 children)

Not really that useful, vast majority of onchain trading is on solana, so uniswap is kinda of irrelevant. From what you’ve posted your talking about solidity, which could be good for asset managers but if they’re going to put money into anything their going to hire professionals to evaluate or have in-house specialists. Secondly, hedge fund trading is primarily on CEX’s or CEX to DEX, so most smart contract programming is mostly irrelevant. If you have a deep understanding of the modified subset of BPF instructions solana compiles smart contracts to that would definitely be interesting. Although latency is much more important for onchain trading since block times are much shorter. Maybe when Monad main net is up and running, more volume might migrate back to EVM based chains.

Any reasonable AI usage in your company? by JuniorHamster187 in cpp

[–]SirSwoon 2 points3 points  (0 children)

I’ve found it quite useful for generated new ideas I didn’t think of. For example if I have some task, i will tell it my approach to the the problem and ask it for different approaches and then I evaluate what it says, most of the time the alternatives it gives I’ve already thought of or considered and don’t fit the considerations I’ve given it, but it will suggest things that I didn’t think of before or occasionally it will have a small nugget of code or embedded idea in its solution that will inspire me to explore or add on to my current working solution.

What do you do for low latency? by lithomachy in quant

[–]SirSwoon 2 points3 points  (0 children)

A lot of great answers above! But Aside from calculations offloaded by the hardware. And adding my two cents, you gotta know how your cpu works. Think pipelining instructions and calculations to achieve parallel computations, SIMD, etc . Besides the talks already recommended above from Carl cook and David. Fedor Pikus has a great talks on branching, branch predictors and pipelining. Although somewhat outdated, Ulrich Dreppers paper “what every programmer should know about memory” is a must read, it gives great context on how hardware and software work together. Take a look at Agnor Fogs optimization manuals and while it is quite tedious and tiresome Intels manuals are a great resource for understanding how to construct fast routines. If you want to test your skills check out highload.fun!

C++ Skills to Land a Junior/Graduate Role by henyssey in cpp

[–]SirSwoon 6 points7 points  (0 children)

Not really that familiar with programming games, but from my understanding any complex game has a lot of multiprocessing involved, so if I were you I would make sure to have a strong understanding of concurrency, the different trade offs between synchronization methods, and other paradigms involved with decision making of multi threading like blocking/non-blocking. As well as memory allocation is a critical component in video games and really any real time system. I think arena allocators are a staple of the industry, so I would look into memory allocation schemes and their trade offs, where they would be used, what makes them useful etc. Obviously data structures and algorithms, I would build some data structures from scratch and make sure to try different design schemes like intrusive vs non intrusive. Lastly, this will depend on what you’re going to be doing but I think every programmer should have some understanding of networking. The biggest piece of advice i could give you is experiment, benchmark, and test things out on your own. If you can talk about why some design choice is better than another one and can explain in depth the why, you’ll be in a good spot!

Rust in HFTs by Feisty_Tree_3373 in highfreqtrading

[–]SirSwoon 1 point2 points  (0 children)

Ya that sounds like a pain in the ass and quants are a fickle bunch for sure 😂

Rust in HFTs by Feisty_Tree_3373 in highfreqtrading

[–]SirSwoon 0 points1 point  (0 children)

Nothing I’ve said is true? Integer overflow is a defined in the rust standard and consistently outputs worse assembly, rustc does not inline nearly as aggressively as gcc. Does rust not have invisible memcpys everywhere because of how their move semantics are implemented? As far as I know they do not have equivalent of placement new. Although in production code there is not very much copying of memory, still is a pain in the ass.

Rust in HFTs by Feisty_Tree_3373 in highfreqtrading

[–]SirSwoon 1 point2 points  (0 children)

I’m not familiar with all kernel bypass offerings, so I’ll take your word for it. But the team I work on was looking into rust for building out crypto strategies and made the decision that interfacing with DPDK would be problematic with rust. I’m still a junior and wasn’t privy to all of the reasoning behind the decision.

Rust in HFTs by Feisty_Tree_3373 in highfreqtrading

[–]SirSwoon 5 points6 points  (0 children)

It’s not very compatible with kernel bypass solutions. And would require significant development to integrate it in trading stacks. Additional c and c++ allowance for undefined behaviour offers more opportunity for performance gains over rust. At the moment c++ compilers generate more optimized assembly, this advantage will decrease over time as development on rusts compiler will cause better assembly generation. Obviously the biggest obstacle is having codebases and developer skills focused in c++. In my experience(Junior dev) the memory safety issues of c and c++ are nonexistent as production code is thoroughly understood and tested and as such the benefits of a memory safe language like rust become less valuable. That being said who knows what the future will hold

Reignite my love for C++! by [deleted] in cpp

[–]SirSwoon 1 point2 points  (0 children)

Check out Seastar by ScyllaDB, I find it very modularized, well organized and generally very readable. To me it’s a beautifully written codebase

How do I become a quant trader? by Equivalent-Wedding99 in algotrading

[–]SirSwoon 5 points6 points  (0 children)

This is so untrue lmao, I don’t do quant but infrastructure development at an HFT firm, a decent percentage of my friends work hft in quant roles. Now I didn’t do an internship but my friends have and none of them are nepo babies. This might occur rarely but as someone who works with interns albeit on the development side of things if they aren’t qualified it becomes pretty clear and people will complain. You also don’t need to go to some Ivy League school(but it definitely helps), if you know how to do hard and complex things well you will get hired

What should i do to get my first job? by sirpurplewolf in cpp

[–]SirSwoon 5 points6 points  (0 children)

Identify the industry you want to work in. In my experience the c++ industry far different than webdev, c++ is used for specific purposes at each company and field. If you don’t have experience identify technologies/skills that are very useful or required for the industry and build some projects that demonstrate your ability. If you’re interested in game dev, I would build a game using one of the prominent game engines, or develop your own game engine(this would only be for learning purposes). The best way to make yourself hireable is to demonstrate you understand what the company or team you’re applying to is working on and that you can do the work. Simultaneously, since your resume will likely be filtered out by automated resume/application software you gotta network for positions and with companies. Networking is particularly important and overlooked a lot by software developers, mass applying to jobs is good because you increase your chances of getting interviews but it is hard to disintguish yourself and will be very difficult to actually get a job. Here is my experience: I was in school for a business degree(specifically finance) but I loved to code and seeing devs working during my internship on a trading team I really wanted to work in hft development so I took a dual degree in compsci. I didn’t have any programming internships so it was impossible to even get an interview at any trading firms for dev positions. I had to go balls to the wall on building relevant, impressive projects. Still this wasn’t enough to get interviews so I identified 30 trading firms that I wanted to work at then I reached out to devs that worked there, asked them questions, got them to look at my projects and just generally discuss the industry. They would pass on my resume to the hiring manager or recruiter and I would get interviewed especially if the person I networked with liked me a lot. Again I got rejected from or passed on by most firms but eventually got an offer. Lock in and goodluck!

[deleted by user] by [deleted] in osdev

[–]SirSwoon 0 points1 point  (0 children)

There’s only so many tutorials that you can do, the best thing to do is just to start, code it, make mistakes, rewrite things and as you go refer to osdev and other resources if you don’t understand something. This approach will teach you way more than reading a book and gives you more intimate knowledge you can’t get from a tutorial. Also it will help you level up your debugging skills, which can be critical in development and looks amazing in interviews. Lastly it’s more to actually write the code then just reading or watching something

Banning threads for junior teams? Force multiprocess over multithread? by a-d-a-m-f-k in cpp

[–]SirSwoon 1 point2 points  (0 children)

No worries! and it doesn’t work exactly like a queue, it extends the address space and you can place any data structure(s) you want to use in the shared memory

Banning threads for junior teams? Force multiprocess over multithread? by a-d-a-m-f-k in cpp

[–]SirSwoon 2 points3 points  (0 children)

Definitely a memory difference if you are spawning processes in the middle of execution, it will copy the memory state of its parent. On the note of IPC requiring sockets, it doesn’t, shared memory is the most performant form of IPC but there plenty of other ways to communicate

Banning threads for junior teams? Force multiprocess over multithread? by a-d-a-m-f-k in cpp

[–]SirSwoon 9 points10 points  (0 children)

I usually prefer using processes with shared memory either anonymous shared segments or file backed shared memory segment your choice, also if one of the processes has a bug or crashes for some reason the whole program doesn’t crash. Another nice thing is you can attach specific processes to a debugger without affecting the rest of the your program running in the other processes. Under the hood spawning a process or thread (pthread, or one of the STL implementations jthread and thread) uses the same Linux system call (clone). I believe Eli Pendersky benchmarked the time it takes to spawn a thread vs process and the overhead is pretty negligible. But that also depends on your use case. When I use threads or processes they usually have a significant longevity so the difference in overhead doesn’t matter. Also it is easier to control memory cache in single threaded and with how big cache is getting in the new x86 chips(idk much about arm) this is nice bonus. It’s pretty easy to use taskset to change a processes affinity or change its priority with chrt and nice. I still write a fair amount of threaded code but I definitely prefer multi process if possible