| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
<_nv> You should find that old automated rant generator and improve on it! <ZorbaTHut> all dynamically generated gibberish <kawfee> DynamicGibberish.com <kawfee> hey, it's not taken either <_nv> http://www.pakin.org/complaint <kawfee> ZorbaTHut: you should buy that one too <ZorbaTHut> kawfee, nah. <kawfee> yah <kawfee> do what I tell you to do! <ZorbaTHut> no. :P <Zeromus-X> well lemme ask this -- i'm doing a project involving the CPU scheduler; I believe I need to simulate 100,000 processes, and each CPU unit is the time needed to execute a loop 100,000 times. Does that sound like it's going to take a ridiculously long time? <kawfee> do it now! <kawfee> =p <kawfee> ZorbaTHut:
<hotnikks> im using the C++ Sockets library and am calling the Handler() function (http://www.alhem.net/Sockets/html/Socket_8cpp-source.html#l00650) of the SocketHandler cl***. this returns a reference to a sockethandler, but what i actually want is a reference to the object derived from sockethandler. how would i accomplish this? <[proxy]> Zeromus-X: you "beleive" you need to do that? <[proxy]> what are the requirements of the project? <hotnikks> basically its just giving me the base cl***. can i cast to the derived cl***? <oxix_m> you guys think it's a bit excessive to make a header with one function? <[proxy]> hotnikks: yes, use dynamic_cast <[proxy]> Derived *d = dynamic_cast<Derived *>(b); <hotnikks> [proxy]; compile not letting me :/ <oxix_m> but that one function's implementantion spans hundreds of linse <kawfee> oxix_m: no <oxix_m> lines, oops <hotnikks> one sec <[proxy]> it'll returll null if it's incorrect <oxix_m> yay <kawfee> oxix_m: I'm modular though. <[proxy]> hotnikks: btw, i dont think that would work with references, only pointers <Zeromus-X> [proxy]: The requirement says that each run will handle scheduling of 100,000 (simulated) processes, and to make a generator to generate the process requests. Each process has params ProcessID, ArrivalTime, Priority, CPUBurstUnits. Each CPU unit is equivalent to CPU time needed to execute the loop [insert code here, but loop iterates 100,000 times] <hotnikks> right <hotnikks> so its a reference <oxix_m> kawfee: the function is there to retrieve a derived instance through a polymorphic base pointer <Zeromus-X> when they say handle scheduling of 100,000 simulated processes, I ***ume that means my generator needs to create a file with 100,000 process IDs, along with accompanying arrival time, priority, and burst unit data. <kawfee> oxix_m: why is it not part of the derived cl***? <hotnikks> compiler error is cannot dynamic_cast of type 'c*** Base' to type 'cl*** Derived*' (source is not a pointer)_ <[proxy]> Zeromus-X: well sounds like you need an awful lot of threads :-P <Zeromus-X> it sounds excessive! <[proxy]> i agree <oxix_m> some_base_type* get_some_derived_type(); in cpp: struct some_derived_type: some_base_type {...}; static some_derived_type instance; some_base_type* get_some_derived_type() {return &instance; } <-- like that <Zeromus-X> it's just for an operating systems cl***, to measure the difference between FIFO / SJF / etc <Zeromus-X> I think I'm reading it wrong. <oxix_m> the derived type implementation is pretty hefty, but the type doesn't need to be made available in the header <oxix_m> only need a base pointer <[proxy]> Zeromus-X: well quote it exactly <Zeromus-X> http://rafb.net/paste/results/swANl970.html <Zeromus-X> dropped the instructions in there <Vova> hey i have a conceptiual question.... .if a "+" overload of two dyanmic structurues produces a new object in the heap.. isnt memory lost when you do dstruct1+dstruct2+dstruct3+dstruct4.. <Vova> dynamicstruct dstruct0=dstruct1+dstrcut2+destruct3... <Cowmoo> lost? <Cowmoo> oh <Cowmoo> yes <Vova> Cowmoo..so how do u prevent that <Cowmoo> why do you need to allocate from the heap for this? <ZorbaTHut> vova, make sure that anything produced in the heap will be cleaned up by destructors properly. <[proxy]> Zeromus-X: sounds like you have it right..but for one detail, it's not 100,000 processes at once <Vova> Cowmoo im not sure... <Cowmoo> if you have to, do what Zorba said <[proxy]> they arrive "randomly" in my interpretation and thus you need to make a generated which adds new ones to the queue <Zeromus-X> .. <Vova> im trying to overload + for two linked lists <Cowmoo> for every new there should be a delete <Vova> i was thinking of producing a third one <Cowmoo> ok <Zeromus-X> but how would they be able to be sorted (best order, etc) if they're not known in advance? <ScottC> Is it a bad idea to go directly into windows programming in C#? <Cowmoo> just make sure to call delete for every new <pepp^> ScottC: no. a good idea <Zeromus-X> perhaps I just have no clue what's going on. Suppose that's possible. <ZorbaTHut> scott, no, that's reasonable. C# windows programming is pretty easy <Vova> thanks guys <ZorbaTHut> vova, if it cleans itself up when it goes out of scope properly (i.e. via destructor), it'll work fine <Zeromus-X> my ***umption, looking at the instructions, was to use a random generator to create a file with the threads. Load the threads up. For FIFO, ***ume they're all coming in in order. For things like priority, I'd have to go through the list and re-order, etc. No? <kawfee> C# rocks!
<kawfee> Vova: remember the rule of three <Cowmoo> Zeromus-X: please tell me this isn't due tomorrow <[proxy]> Zeromus-X: i'm not sure what the prof wants, should have paid more attention :-P <Zeromus-X> [proxy]: agreed and prof hasn't responded to emails in three weeks (web-based cl***), and hasn't returned phone calls. ****s. <ScottC> In WinAPI you have to do a bunch of crazy **** to make a window kawfee... <ScottC> How about in C#? <Zeromus-X> Cowmoo: It's not due tomorrow. <Cowmoo> oh phew <Zeromus-X> Cowmoo: However, tomorrow is the only time I'll be able to meet with him for questions before it's due, so I'm trying to get as much done as possible tonight. <ScottC> to make a window do you have to fill out some struct, register it, and create it, and of course have a WndProc for it? <kawfee> ScottC: C# rocks! <ScottC> in C# <Vova> ZorbaTHut: I have a linklist cl*** and a node cl*** .. your saying the destructor should in the linked list cl*** <kawfee> ScottC: nope. <kawfee> ScottC: you just do .show or soemthing <ScottC> I really like the GUI editor <Vova> should traverse the link list and free all terms? <ScottC> in MSVS .net 03 :P <Cowmoo> yes <kawfee> Vova: what? <ScottC> Good thing to use kawf? <kawfee> ScottC: vs2003 is ok. <kawfee> ScottC: that is what I use for dev <ZorbaTHut> vova, yep. <kawfee> ScottC: at least for C#. <Zeromus-X> OK, so you guys think they should arrive randomly, eh? As in, run the random generator during the course of program execution in another thread? <kawfee> RAPHIE! <ScottC> yo kawf <kawfee> ScottC: what? <ScottC> Have any links to sockets w/ C#? <Raphster> hey <kawfee> I haven't don't sockets in C#. Search msdn. <Vova> ZorbaTHut: this way when i say LinkList myList = Lst1+ Lst2+Lst3... all the intermediary values will go out of scope and be dealocated <Vova> automatically <ScottC> does the C++ sockets library work with C#? <ScottC> or no? <kawfee> dunno <kawfee> ScottC: http://www.c-sharpcorner.com/Network/SocketProgDTRP.asp <kawfee> !g socket programming C# <Kniht> kawfee: http://www.c-sharpcorner.com/Network/SocketProgDTRP.asp <ScottC> I just googled it <ScottC> and found that :P <ScottC> i should google more before asking <kawfee> ScottC: that's a pretty good site <Vova> kawfee what is the rule of three? <kawfee> ScottC: try the code guru and codeproject one too <kawfee> calc triad <CalcMe> triad = Rule of Three: If your cl*** has any one of { copy constructor, copy ***ignment operator, destructor }, odds are high that it should have all three. <kawfee> CalcMe no CalcMe <Zeromus-X> Cowmoo: If you're still here -- any idea of web resources that might help me out implementing this? I'd love to have more than a blank file tomorrow. :/ <kawfee> Zeromus-X: do what? <Zeromus-X> hell, I dunno anymore. It's 1 AM. <Zeromus-X> I guess without clarification of whether or not these processes are supposed to come in at random or whether they're predetermined from a random generated file, there's not a lot I can do. <Cowmoo> Zeromus-X not really, I did this project in school 1.5 years ago <Cowmoo> ask your professor is all I can say <Zeromus-X> For yours, I ***ume they were coming in at random, since that's what you ***umed earlier? <Cowmoo> we had a randomly-generated file <Cowmoo> with a list of processes, their priorities, etc <Zeromus-X> sounds like what I've got right now. Just a really, really big file. <Cowmoo> it seems from your posted description that it's the same with you <Zeromus-X> Processes, Arrival time, Priority, and CPU Burst units. <Cowmoo> "Your scheduler program reads the file and simulates real <Cowmoo> process arrives." <Zeromus-X> so rather than reading in everything to an array, just read in the first line, then when that time elapses, read in the next line, etc? <t35t0r> i'm trying to do something like this: template <cl*** T, cl*** U> void runSort(T algorithmObject <U>) { ... } int main () { heapSort <int> h1; runSort(h1); } // what's the correct way to do this? <Cowmoo> I think the actual implementation of how you read them is up to you <Zeromus-X> hmm... okay <Cowmoo> e.g. if they have ***ociated priorites, then I'd imagine that you'd be reading them in and building a priority queue as you go along <t35t0r> for example the cl*** T might be quickSort or something else <Zeromus-X> i'm gonna try it this way, at least for FIFO, since that's all that's really necessary <Zeromus-X> but reading them all in causes the stack to overflow, so I'm trying to avoid that. we haven't discussed moving them to the heap, so I can't see how that'd play a part. <Cowmoo> oh um <Cowmoo> k I dunno, I definitely resorted to the heap
Return to
#c++ or Go to some related
logs:
#hotsex download Lost s03e05 #lisp wow Goblingworkshop #hotsex #azkalix MANY CORALS RECEIVE NOURISHMENT FROM ALGAE WHICH G Gazap Ateşi filmini izlet #chatzone
|
|