What about reaching out to influencers? So the person asked here about reaching somebody that they really feel like they would have a connection with, maybe professional benefit for each other, somebody who has a way bigger audience than they do, not like a celebrity that, but somebody that they might write back that's not a household name yet, but way bigger audience. And it feels the person who is wanting to reach out to that influencer, it feels a bit of like a cold call, right? Yeah, I get it because that person doesn't know you yet. And so I wanna speak to this because over the past couple of years, as my audience has grown, I'm not a celebrity by any means, but I have certainly gotten more and more cold emails, cold direct messages, cold Facebook messages and things like that, people who wanna connect with me and whether it's LinkedIn, Instagram, Facebook, Twitter, email, et cetera. And I'll speak from my perspective as somebody who feels like they need to, I feel like I need to keep my time very tight and keep my connections pretty tight as well because I don't want to give the impression, I'm still learning how to do this. I don't wanna give the impression that, hey, I'm just sitting around all day posting content and you're welcome to just ask me whatever because I had nothing better to do. Oh, you had a question? Let me send half hour answering the question. Who's got the time? I don't even want to spend five minutes, not even three minutes answering a question from a random person, right? And I'm developing templates over time on how to be gentle about it and to say buy a course for me essentially and come to a Q and A call and that's how I do it these days. So I'm thinking about the person who's wanting to reach out to this influencer and what should they say? Should they reach out and what should they say? Here's my perspective from the little micro influencer side of things who is very busy and good time manager. So you might say I manage my time as well as a larger influencer might, okay? So if you were just a message me and say, oh, George, I connect so much with your content and maybe here's why, maybe we could be friends. Do you wanna do a Zoom call? I'll be like, you're being too forward. Why should I give you any time? Why should I give you any time other than just having read your message and not clicking spam either? Now, why? Well, George, I was so nice. I said very specific things about why your thing and my thing could relate and I'm like, but still I could do that with it. I get three of those messages a week. If I did that to all three people, you could say, well, George, maybe the universe wants you to do that. Okay, but I'm the one reaching out to other people to say, hey, you wanna get in oftentimes people say yes. So no, don't reach out to influencers cold to say, can we hang out or can we talk even through messaging? Cause they don't have time for us. I don't have time for you. You don't have time for others to do that to you, right? Like in the beginning, it's true. When you just want clients, when you just want any interaction, I get it cause I was there for many years. Someone messaged me. They wanna be friends. Sure, you're my best friend now cause no one else messages me. You know, it's like, I get one of these every three months and that's fine. But once you start getting more and more, you're like, okay, I have to find the strategy to do this. So that's all the influencers you're wanting to reach out to, just imagine it's a good exercise to say, what if they got three of those a day? Just as thoughtful as yours, just as serendipitous. And oh my God, what a synchronicity that we have this in common. Imagine them getting three of those a day. How would you like them to respond?  That's a good exercise because you go, no, no, that doesn't make any sense. Instead, here's what I like. First of all, I do like it when people share my stuff, right? So like on Instagram, it's easy because you could share someone's Instagram post as a story and it's not too intrusive to your followers cause only your most dedicated followers see your Instagram stories. Same thing with Facebook stories, right? Posting on stories is a lot less intrusive to your audience than making a normal post, a normal post in the Instagram grid or timeline on Facebook. Stories is only for, the only the biggest fans will see your stories, okay? That's how it's been designed. So sharing on stories is like is a, it's essentially a very low cost way of saying hi to an influencer. So I get people doing that to me all the time now. I get, thankfully, I get at least one or two of them a day and people share and here's the key. When you share someone's Instagram post, you have to at mention or target them or not at mention them, tag them, sorry, not target, tag them. And what happens is that influencer will get a private message request. It's a message request, but most of us, at least me, most micro influencers, people who are not celebrities yet with, but even celebrities with teams, they have teams that check the message requests because there might be something important in there, right? Message requests. So we get tagged as a private message, we check the message request and we see, oh, so and so has shared your post and tagged you in the sharing of it. And the more thoughtfully you can share the post, not just share, click share, tag and then go, but that's generic and it's not very thoughtful. But if you could say, oh, George Cow's work has blah, blah, blah and this is why it resonates so much, then I'm gonna pay attention. I go, ooh, this person is really nice.  We're not at that level yet, but at least you have major presence known to me. Again, when I say me, I mean imagine this as any influencer you're reaching out to. You've made your presence known to me in a very thoughtful, nice way. At least I know your name at this point or at least I've taken a quick look at your profile probably or I'll click like or love for the share. And if you do that several times, obviously now you're kind of a household name in my mind, right? Cause oh, this person, second or third or fourth share of mine that they've tagged me. This is actually a good thing to know when you do share someone's Instagram post as a story, you might as well tag them because then they'll know that you shared it. There's now everyone watching this and now they're gonna send me a billion messages right now because otherwise I do get a lot of people sharing my Instagram posts and they never tagged me. So I don't know who shared what on Facebook is different. When you share someone's Facebook posts, they can at least see if you shared it publicly. That's fine. But on Instagram, you have to tag them, tag their Instagram URL, Instagram handle in order for them to don't get a private message. They'll see that you shared it. So once you share several of their posts and do it in a thoughtful way, add a note, like add a paragraph why you resonate so much then you are essentially recognized in their mind whenever they see it, oh, what a nice, that's the nice person. That's the nice fan who always shares my stuff. How cool is that? Great. Now the next step is more, the first step is easy, sharing their posts. The second step is more tricky because what do you wanna do now with that? The second step, you could say, well, I'm gonna go ahead and invite them to a Zoom call. Yeah. Like I said, I protect my time so well. I don't even do any exploratory calls anymore. If someone wants to hire me as a client, I don't even take clients anymore. Like I literally says, you wanna pick? No, I don't take one-on-one clients anymore, right? Which is what most influencers are. That's where they are at as well. So I don't do exploratory calls. Someone says, I wanna join your programs. No, I don't have time for exploratory. Come to my, buy a course, come to my Q and A, that's my exploratory call. Or rather, all my videos that I post publicly for free, those of our thanks for exploratory calls, right? That's how I gauge fit with people. You like my videos and you probably like my programs or come to a Q and A and then we'll interact that way. So no, I'm just asking for a call for an influencer. I think that's too forward and that's rude in my opinion. It's too forward. So instead, there's two strategies that I can think of. You either get introduced through a mutual friend that the influencer respects. Now, how do you know, right? You go to LinkedIn, you search that influencer and see if you have a mutual connection on LinkedIn or go to Facebook, find that influencer on Facebook and see if you have a mutual friend. Because that mutual friend can take this a long way to say, hey, so let's say Grant was trying to reach me and Grant and Mira are friends and Mira is a friend of mine too. And so Grant will go to Mira and say, hey, Mira, do you know George well enough? I'm trying to connect with him more because maybe a collaboration or project of, would you feel comfortable making the introduction? So through a mutual introduction is much better because I respect Mira. And so Mira makes that introduction. I'm much more likely to say, well, for Mira's sake, I'm gonna at least respond privately to this person and see how I can help. I might not jump on the Zoom call with you. Maybe, maybe not. But at least through messaging I can help you in some way or give you some guidance or shares. So then the question is, whether you go through a mutual introduction or not, the question is what is your pitch, I guess, or what's your invitation? Why do you want their time? So now you might, what's not okay is to say, like, okay, I just received this today, by the way, this is a good example. Somebody that I actually do respect, because I'm gonna use names, fake names, okay. These are not real people. Let's say Jane, Jane, okay. Jane is trying to get me, George, to promote Jane's next program, next course. That's Jane's agenda. Jane wants that to happen. Jane wants me to promote Jane, okay. Jane went through Tad Hargrave. I can use a real name, because Tad, Tad is a friend of mine, a respected colleague. I love Tad so much. And Tad likes Jane a lot too. I actually have heard of Jane. Jane has done some work that publicly I've heard of and has heard good things about it. But Jane just approached me today and said, George, Tad is promoting my next course and thought that you might wanna promote it too. Here's what Tad has to say about it and gave me a paragraph from Tad. Oh, Jane is wonderful, trusted colleague and friend. You can't go wrong promoting Jane's stuff.  But it's like, Jane, your first message to me is just say, George, promote my thing. And here's why, because your mutual friend Tad says you should promote my thing. I was a little pissed by that, because I'm like, what's in it? I mean, yeah, what's in it for me? Oh, commissions, fine, that's fine. But I could promote anybody. There's so many people I could promote to get commissions. But every promotion slot costs me social capital. Right, it costs me every time I send an email. This is true for anybody, right? And every time you send an email, you get unsubscribed, right? Every time you promote something on social media, that's one less spot to promote your own thing or someone else's thing, right? Every promotion costs. So you can't just say, you're gonna pay someone commission for this. That's not good enough. Now, what's good enough to say, Jane might've said, George, if you wanna promote this, I'd be so grateful. I'd be happy to give you free access to it. But she didn't even say that. Be happy to give you free access to this thing. So you could take a look, you don't have to promote it, but at least have free access. You can see, you might learn something yourself or you might enjoy it. You might see how I do things. I'd be grateful for feedback, just as a gift. Don't have to even promote it. See, that's much more gracious. It's much more like, come on, you know, like, right? I'm just honestly surprised sometimes. It's like, in real life, you wouldn't do this. How come it's okay to do it online? It's like, right? Anyway, so Jane, that's what Jane's message is like, promote my thing, not try to say it in a nice way because Tad said so, okay? All right, not good enough. Not gonna promote her. Now, I said very nicely back to Jane. I was a little bit surprised. I wrote back, oh, Jane, I've heard good things about your work. This is not the right fit for me, but maybe we'll be able to collaborate in some other way in the future. Now, what I hoped Jane would write back would say, George, I've heard great things about you too. I mean, at least look at my website or something. I would have wished Jane would have said, oh, great, look, I love your stuff too and please let me know if there's something I can promote. Jane didn't say that. Jane just said, great, I'll keep you in mind for future projects.   It's like always, like the person's thinking of themselves and how can this person promote me and benefit me?  So back to what should we say to an influencer, ideally get introduced, but even getting introduced, what should your pitch be? The pitch should be, like I said, something that the influencer goes, it doesn't cost me anything. I don't know who you are and you're giving me a gift. It should be that. And what should be the gift be? Now, the gift isn't, here's my book for free. Now, books are not good gifts, especially to the busy people. Books are homework, okay? Courses are also, courses are a little bit more interesting to me because at least I can see, I'm more interested in seeing how they run the course because I can learn something from that. The course material may or may not be good. I've seen so many courses, I'm like, whatever, but how they run a program, that's more interesting to me. How they market something, that's more interesting to me because I can learn something from that. But, so maybe not a gift like, hey, you don't know who I am, we're fine, we're introduced or not. Here's some homework for you, here's a book, here's a course, no, don't do that. But the simplest gift, can I promote you to my audience? Can I interview you? Now, the larger your audience, the more it's an actual gift. Like, if I check you out on Instagram and you have 100 followers, you interviewing me is, it's, sometimes I say yes, sometimes I say no because I have almost 8,000 followers. You have 100 followers, is it a gift or is it more just a, I could spend my time doing other things, right? Now, if you have 800, if you have a 10th of my audience, 800 followers, okay, I'm a little bit more interested now. If you have half of my audience, oh, definitely. Sure, you can, you wanna interview me, that's a gift. So, you know, I, but okay, so interviewing me is a gift, especially if I don't have to prepare anything.  And they give me all this homework, like please answer these 25 questions to follow me. This is just homework for me.  Why would I, right? Like you gotta make it so easy for me. Like right now I'm running a summit, okay? I made it so easy for my speakers out, you don't have to promote the summit. And I'm gonna ask you just a few basic questions. Like I'm gonna find your photo. I made it so easy for my summit speakers, like I'm just sitting back and you're just gonna ask me a few, and then you're even gonna pay me? Yeah, I'm sharing the money with my summit. So like this is, I'm just giving you an example of how gracious you have to be to become business friends with somebody. You see what I mean? It's not that easy. So like I said, you can interview me if you have a large enough audience or another interesting gift would be this. George, I'm doing some research that might interest you. I'm just gonna ask you like two really simple questions and you could record your answer if it's easier just three minute recording or something like that. And what I'm gonna do is I'm going to collate all the answers and I'm gonna share it with you because you might be interested. Maybe it's some kind of industry research or just something that I don't know. There's some kind of question that I believe you're interested in and you contribute to that. And not only am I going to share the answers with you but I have also promote you as one of the people who gave an answer. And so some people call this a roundup post. You may have seen this online. It's like expert roundup, right? It's like you go to 12 different experts, you get a quote from them each and then you do a nice blog post with 12 different posts. I mean, that's one way, that's a very basic research but it might be more in-depth research where you're like, I'm gonna ask you for a quote or I'm gonna ask you a question that you can quickly respond to.  It's like, oh, okay. And what's even more interesting is if you said, I'm gonna sell the answers, it's gonna be a product and you don't have to pay for the product because you gave your part of it. So I'm gonna give you the product for free. Cool, right? So one, yeah. So anyway, just a couple, this has gone a bit longer than I expected but I, as you can tell, it's a bit of a soapbox for me because I get these kinds of messages too often and I'm like, people wouldn't walk up to you in real life, right? And go, you don't know who I am, but I want you to buy me dinner. That's essentially what you're asking someone or you have no idea who I am but I like half an hour of your time. Like you wouldn't do that in real life. Why are we doing that online? It doesn't make any sense. People just don't have that connection. Like it's the same thing as real life. Like, in real life, you wanna become someone's friend, you have to be super gracious too, right? You have to be like, find creative ways to invite them to something that they really want. So think about that. And yeah, so in other words, I don't think some really well-worded message of synchronicity cuts it anymore. Especially the larger the influencer, the less that matters because they get, imagine them getting three of those amazing, you know, we were born on the same day in the same town and we have our sisters have the same name, whatever. And I've done these, I might have the exact same educational background. Doesn't matter. I have the same interests. We also like this obscure band or we have this obscure teacher. We both like none of that. All those synchronicities you can mention, I'm getting three of those messages every week. So you have to think more creatively beyond that and say, how can I be, how can I be gracious beyond this? And I'll tell you, it's not.  In other words, people invite me to interviews all the time. So that's already more gracious than can I have some of your time? But if the interview was more interesting, like they have a sizable audience, doesn't have to be bigger than mine, even if it's half the size of mine or even a third of the size of mine, great. Even a quarter of a size of mine. I'm like, okay, fine. A tenth of a size maybe, right? But if the interview also was on something where I'm not just regurgitating the same thing I say in every interview, that's much more interesting too, right? Like George, I would like to interview you about your spiritual path, right? Like Leia did that, right? Like Leia is here on the live call. I would love to talk about that. Like I never talk about, like if you're gonna interview me about what is marketing, what's authentic business, I'm fine with that. If you have a large enough audience, I'm promoting myself, great. If you have a small audience, I don't wanna talk the same thing that the 12th interview I'd done in the last quarter of something that kind of gets boring. It's like, George, I wanna talk to you about your dog, buddy. It's okay, all right. It's fun stuff. No, that's not a great example, but like, yeah, the spirituality thing was interesting or politics, right? Like I have some strong opinions about that stuff. No one ever asked me about it. And so that's a bit more interesting. So yeah, like find some kind of angle that you think, wow, that person probably would love to talk about it. No one asked them about it. Yeah, so I hope this is helpful and I look forward to seeing if you have any other ideas or questions below. Yeah, and I just wanna say I appreciate that the chats here, thanks to Nam and Mira and Lea and Liz and Grant and others. Mira said, it's counterculture. You know, we have to practice graciousness to resist the pressure towards selfishness that we're all under. I agree. Building a business is not easy, of course, as you've noticed. And it's so easy for us, myself included, okay, to just reach out. And there are some influencers like Gary Vaynerchuk who are spreading, I think a wrong message to say, just DM a thousand people and you'll get 10 people saying yes. It's terrible, terrible message because you're DM direct message. Basically people like Gary are saying, just send a private message to a thousand influencers and maybe 10 of them will say yes to promoting you. I'm like, you have just set up a poor relationship or the beginning of one with 990 other people. Like, why would you do that?  Like, what a painful task that is. Like, why would you do that? But instead, if you take a moment and I know I'm speaking to myself too because I have the tendency to like message and influence, hey, can we interview each other? Like maybe, maybe not, you know? So I have to slow down too and go, instead of messaging 10 people, if I graciously message one person, that is better for number one for the relationship and better for my spirit too, for how my day was, because I thoughtfully messaged Grant. You know, like thoughtfully, instead of I have half an hour, I'm gonna message five people in the half hour, like just, hey, why don't you interview me or can I interview each other? You know, take half hour, think about Grant and really go into Grant's world and say, what can I say that is gracious? Like, what can I do? And that's just being the gracious human being that you normally are when you take yourself away from the pressure of networking or building the business or whatever it is and go, I'm net-caring, I'm net-caring, I'm really connecting with one person at a time. And they may not write back, but at least I've practiced compassion, I've practiced graciousness and isn't that itself worthwhile as a human being to do? Instead of practicing the hustle and grind of sending out messages to 10 people in half an hour, you know? So it's part of the personal growth benefit as well.


Suspense! Autolight and its 96,000 dealers present Mr. Robert Taylor in Four Hours to Kill, a suspense play produced and edited by William Spear. Oh, there, Mr. Wilcox. I am Jay Hamhawk-McBeth of the Legitimate Theatre. I've just been signed to announce a new show. Relax. Okay, let's hear you do something with famous autolight resistor spark plugs. Of course. I might begin thusly. To be or not to be, that is the question. Oh, no, no, no. The only question is how soon autolight resistor spark plugs will be demonstrating their advantages to every car owner in the land. But I...  What's more, autolight resistor spark plugs have 200% longer electrode life. Cut down spark plug interference with radio and television. I want to see your friendly autolight dealer and have him install a set of the new autolight resistor spark plugs in your car. Remember, you're always right with autolight. And now with Four Hours to Kill and the performance of Mr. Robert Taylor, autolight hopes once again to keep you in suspense. So you want to know what's the matter? What's wrong with me? Okay, sit down on that bench over there.  You know, now that it's over, I can look back and see everything in perspective. Clear back to the days when my brother Walter and I were kids in Vermont. And I can see now that my life's divided into two halves, the first 34 years and the last four hours. Yeah, four hours ago I was standing at the big front door of the bachelor's club on my way up to see Walter for the first time in five years. I knew it was going to be tough, but things had changed since the last time we were together. Walter arrived now. He was a kind of New York lawyer who divides his time between the front page and the society section.  The competition between us was over and I was hoping that now with the numbers up on the scoreboard for everyone to see, Walter might let down a little. Besides, he could afford to call off whatever it was that had set us at each other's throats from the beginning. Anyway, that's what I hoped. As I said, I knew it would be tough. Asking Walter for anything was always tough. Well, I finally swallowed what pride I had left and walked into the lobby. At the desk next to the stairway, the clerk was in a huddle with a bell bell. It's one of those clubs where you're supposed to put a call through the desk before going upstairs. I stood around waiting for a minute, then figured it might be better if Walter didn't know I was coming, so I walked past him. They didn't even say me.  He should have stopped right then, turned around and walked out. It's my exit queue, but I'm up. Well, nothing can change that now. Anyway, I walked on up to the second floor and down the hall to 206. Time you got here. Well, I... Hello, Walter. Theodore. That's right. Big brother Theodore. Well, come on in. You're just in time for dinner. The boy will be up in a minute. No, no, thanks, Walter. I haven't got too much time. You mean you're turning down a free meal? Look, let's forget that stuff, shall we? We're grown up now. There's no point... Shush. Sit down. No, I won't be too long. Tell me, Ted, how are things on the paper in Buffalo? Okay, I guess. I quit yesterday. Oh, you quit? Yeah. Not fired. You quit. That's what I said. So, now you're out of a job and you figure that I'll... Wait a minute, Walter. Let me tell you all of it. There's a guy I met in the service, Dan Allenby. He's down in Florida now, Fort Lauderdale. Look, here's a letter I got for him. He's buying a paper there, a little country sheet, eight pages, twice a week. He wants me to go in with him. It's nothing big, Walter, but it's the kind of thing I've been looking for for years. We can do something down there. The place is growing. We can double the circulation in six months. Dan's got all kinds of ideas and so have I. He says it. What's the matter? What's so funny? You. I don't get it. All right. How much, Ted? Well, the price was $10,000. I'll need half of it. $5,000. That's right. Same song, 82nd verse. I'm not begging, Walter. What is it, then? I'm asking you for a loan. I'll sign a note. Well, what about it? What happened to your pride, Ted? I thought we agreed to forget all. I didn't agree with anything. Not only lost what pride you had, you haven't even got any good sense. Hey, Walter, that answers my question. It's good for a laugh, though. Big brother Theodore crawling up on his belly to...  You thought I'd just...  Hey, let go of me. I've had all of you I'm going to take. You hear that, Walter? I've had all... Let go of me. Okay, Walter. Okay. You've had that coming for a long time, Walter. Yeah, you're right.  Well, get up. Walter, get up. I won't bother you anymore. Walter. Walter. I saw it when I turned him over. A stream of blood oozing out of his right temple where he'd hit his head on the corner of the hearth. No pulse. No breath. Walter was dead. In a spot like that, you don't think. You move. No one knew I was in New York. I was sure the clerk and the bellboy hadn't seen me cross the lobby. If I could get out without being spotted, I had a chance. I picked up the letters from Alanby. Went to the door and put my handkerchief over the knob. Turned back to give the room a last look before I left. That's when I saw it. The telephone receiver was off the hook. Remember, I looked down at it like it was a poisonous snake or something. Started to hang it up, then changed my mind. Hello? Walter? Yeah. Yeah, this is Walter. Really? Sorry, I kept you waiting so long. Wait a minute. Let's have an understanding right now. When I want a good newspaper, man, I'll call you. When I want impersonations, I'll go see the floor show at Leon and Eddie's. Why don't you call your brother and tell him I'm getting tired of holding this telephone? Who will I say is calling? No. I made that pretty clear just before you barged into his apartment. What makes you think I barged in? Just a guess. Am I warm? Not very. From this end, the dialogue sounded more like a Donnybrook than a pink tea. Well, look, let's not go into it. I'll apologize, Theodore. Walter's a class A hero. He had it coming. Now, I'll go pick him up off the floor or wherever you left him and bring him to the phone. Well, he's out of the apartment right now. Why don't you just give me your name and number? He already has it. I gave it to him a year ago in a moment of weakness. Um, tell him I'll call him back in an hour or so when he's better into the talk. Hold it, hold it a minute. Your dinner, Mr. Palmeroy. Uh, listen, Walter won't be back till late tonight. You'd better call him at his office in the morning. You got that? Yes, but he wouldn't... Mr. Palmeroy. If I'd had any sense I'd have given up right then with a bellboy pounding on the door with that girl on the phone who could send me to the chair with a word. But as I said in a spot like that, you don't think something else takes over. Your dinner, Mr. Palmeroy. I had to get my hands on that girl. I knew he'd have her number written down somewhere. But there was nothing on the telephone stand. Nothing in the doors but a couple of bridge score pads and some other junk. I wiped the knobs of the handkerchief and turned back to Walter began searching his pockets. The bellboy was racking some keys outside when I found it. A little brown leather-covered book with some names and numbers in it. I jumped toward the door, slid behind it just as it opened. Mr. Palmeroy, I knocked and I th- The minute he turned the corner I took off for the back stairway. The pack was beginning to howl up front when I left for the rear door. Still unseen, safe, except for that girl. Autolight is bringing you, Mr. Robert Taylor, in four hours to kill. Tonight's production in radio's outstanding theater of thrills, suspense. Let me try a game. Okay, Hamhawk, you're on. Something from Richard, perhaps. I was great as Richard III. Now is the winter of our discontent made glorious summer by- Autolight resistor spark plugs? Now you're cooking, my boy, because autolight resistor spark plugs do get you started faster when it's cold.  The quality of mercy is not strange. And neither is the quality of autolight resistor spark plugs. With their exclusive built-in 10,000 dome autolight resistor, autolight resistor spark plugs give 200% longer electrode life. Reduce spark plug interference with radio and television. Is this a dagger which I see before me? Could be, could be. And the answer to your visibility problems, Chum, is autolight bullseye sealed beam headlight. A horse, a horse, my kingdom, or a horse. Oh, you'll never feel that way, pal, if your car's equipped with white-gap autolight resistor spark plugs. So see your friendly autolight dealer and have him install a set of those white-gap autolight resistor spark plugs in your car. Remember, you're always right with autolight. And now autolight brings back to our Hollywood soundstage our star, Robert Taylor, in four hours to kill. A tale well-calculated to keep you in suspense. I started across town toward Fifth Avenue, walking slowly, letting the cold night air work on my face. By now, the call was into headquarters and a power car was on the way. In a half hour, the homicide men would be there with the police photographers. By nine, the story would be into the morning papers. They'd be out around midnight. Walter was front-page stuff. And that girl, who'd heard it all on the phone, she'd be able to read the headlines. And once she added it up, I was through. I had four hours to find her.  I found a phone booth in a Fifth Avenue drugstore and took out the memo book. He'd scribbled first names and phone numbers on four or five pages. The rest of it was blank. No addresses, nothing else to go on. About a dozen of them belonged to women. So I started on number one. Anna Lee had a Murray Hill number. Is this Murray Hill 4-1-1-2-1? That's right. Is Joanne there, please? Joanne? I'm sorry, I don't know any Joanne. You must have the wrong number. Are you sure? I guess I'd better check it again. I'm sorry. I'll surely be glad to help you all. I'll pop. Is this Maxine? That's right, who's this? Didn't I talk to you a little while ago? Who? Make it Ted, would you? Oh, we're real friendly now. Well, I hope so. I see.  So you went out and bought yourself a crystal ball, wouldn't you? No. No, I just called up every girl in Walter's telephone index until you answered. Because I want to see if the girl is as nice as the voice. Look, why don't you save us both a lot of trouble by telling me where I can meet you? I'd rather... I can be pretty persistent. I can be pretty stubborn. One Pomeroy is about all I can cope with at a time. I'm awfully sorry, Theodore, but I... Wait a minute, what's that music? The radio? No, it's not the radio. And please don't bother me.  Look, you've got at least given me your last name, Maxine. Some other time. But wait. I'm sorry, pal. You forced me to do this. Maxine, wait a minute. Would you tell me if you have a party by the name of... Thomas P. Sherman at Plaza 2, 2376. That's right, Plaza 2, 2376. One moment. I looked at my watch. Nine o'clock. I could close my eyes and see that hotel room now. Jammed with the boys from the police, Pete. Crowding around the medical examiner, grabbing for the phone, shooting questions at the lieutenant in charge. Hello, sir. Yes? We have no record of a Thomas P. Sherman at Plaza 2, 2376. Oh, well, who is listed at that number? I'm sorry, sir. We do not give that information. What about the address of the number? I'm sorry, sir. We do not... Look, I've got to have it, operator. It's very urgent. One moment. No, no. No, sir. Give it. I started to get panicky then. Got a lot of wild ideas about running, grabbing the next plane for anywhere. But I thought it down. I'd been a reporter long enough to know what happens to guys who run. I had to get that girl. I had to. Yeah? You throw it upon. Yeah, yeah, go ahead. Oh, thanks, pal. I've got to get a hold of the little woman, you know. The more I explain to her now, the less I'll have to do when I do get home. Boy, there's sure going all out in that Legion parade, ain't there? Yeah, yeah. Parade? Excuse me. Yeah, sure. What's the matter? What was that you said about a parade? Legion parade coming up Fifth Avenue. Cross-town traffic is tied up for two hours. Coming by here? Yeah, the band is down the street now. Band? That's what I heard. Huh? Nothing. Thanks a lot. Crowds were lining the curbs outside. Down the avenue, somewhere around 78th Street, I could hear the band at the head of the parade marching toward us. The same band I'd heard over her telephone passing so close it almost covered her voice. She was on a low floor next to the street and the band had passed her at exactly one minute to nine. I remembered looking at my watch. I stood there and waited for the band. It was a wild idea, but I had a feeling if I figured it carefully, I could come pretty close. Then another one to make sure. It took them a minute and 20 seconds to cover a block. We hit 84th Street at 16 minutes and 20 seconds past nine. They covered exactly 13 blocks since they passed her telephone. That made it somewhere around 71st Street, on a ground floor. An apartment, maybe a residential hotel facing Central Park. I turned and started running back down Fifth Avenue. I was getting close. And there were still two hours before the morning papers hit the street. An hour and a half I checked Fifth Avenue for two blocks on either side of 71st. Going over name plates and apartment doorways. There were two Maxine's. I talked to one on the house phone. She must have been 70. And met the other one face to face. A hatchet face character who didn't appreciate being gotten out of bed by a drunk who had the wrong apartment. That left only one possibility. A residential hotel in the middle of the block. I decided I'd try calling her again. Walked past the cigar stand in the lobby to her old phone booths at the rear. It was 10 minutes to 11. Time was running out. Hello, Maxine. I'm still trying to worry you down. Because you like my voice. Right. You think I'm charming. Practically irresistible. Right. And another thing. What? I think you live in the Grayson Arms on Fifth Avenue. Wrong. I live on the other side of town. Wait now. Be honest with me, Angel. Hold it a second. She was lying. She knew what it was all about and was playing with me. The panic came back. I looked across the marble floor of the lobby toward the cigar stand. A customer was standing there. A girl that appeared behind a counter to wait on him. Then he left and another guy came in. My heart stopped. It was the distributor with a bundle of morning papers. My mind was paralyzed. It didn't sink in. Not even when I saw the girl turn away and pick up the phone. You were stringing me along about living on the other side of town. Listen, Maxine, you've got to... Hello? Yeah. Sorry. Maxine, have you got the time? Just a second. I saw the girl put down the phone. Hold her watch up toward the light. Five to eleven. When are you through work? Right now. Stay put for a minute and I'll tell you. Hello? I'll be right with you, sir. Hang on, Ted. Yes, sir. Package of those, huh? Yes, sir. 1825. Thanks. Anything else? That's up to you. Oh, now look... Wait a minute. I told you I was a persistent type. Why? You're Ted. Disappointed? Not exactly. How did you find this place? I was just calling from the booth over there. But how did you find this place? My crystal ball. You ought to get yourself a booth at the county fair. You'd make a fortune. It's only a sideline. Do you really live across town? We're just looking brownstone on 75th. But it's home. Good. Then I can walk you home. Walter won't like this. He won't mind. Okay, Theodore, I'm whipped. Let me lock up and get my things. I'll be with you in a minute. I waited while she shut things down. Threw a tweed coat over her shoulders.  Face matched the voice. Dark hair. Wide-set blue eyes with laugh wrinkles at the corners. I wasn't thinking about that thing. I was thinking what a break it was she lived across town on the other side of Central Park. Ted. Huh? Mind if I mention something? No, go ahead. We're going the wrong way. Main path across the park's down there. Yeah, I know. I just don't want to meet any cops. The park's closed after nightfall, you know. You don't mind? No. I don't mind. At the last minute, she grabbed the paper off the pile, folded it and stuck it in her pocket without looking at it. We turned into a dark byway. She moved closer and took my arm. The paper pressed against me like a hot branding iron in my side. My heart was pounding now. There was a choking lump in my throat. I hardly dared to talk. I...  Forget it. I guess I thought you'd be different. More like your brother. Why are we stopping? Why did you do it? What do you mean? You can let your hair down. Walter can't hear us. Why did I do what? You mean you do this every night? Huh? Call up strange women. Tell them you've fallen in love with their voices. Oh. Let's not talk about that now. I don't get it, Ted. Look, I'll tell you later. Never mind. I just thought it was worth mentioning. I guess I was wrong. Night, Ted. I can make it the rest of the way alone. Wait. I mean it. Let go of me. Quiet, Maxina. I don't care. My lips hard against hers. I heard the cop walk by on the main path 50 feet away. Ten seconds, maybe 20, and it would be over. I'd be free. But I discovered something else. I felt a respawn. Felt her arms tighten around me. I said it before. Back in that room with Walter's body at my feet. I stopped thinking. Something else took over. Life going on nerve and instinct. But there in that black pathway in the park, I began to think again like a human being. And I knew that whatever it is that's born into a murderer wasn't in me. That lover or hater, I could no more murder this girl in cold blood than I could fly to the moon. Well, here's the 8th Avenue entrance. Yeah. Why don't you tell me, Ted, I'm just tearing you to pieces. I can see it. Okay. You've got a morning paper in your coat pocket. Take a look at it. Paper? What's that got to do with it? Here, give it to me. Page one. I knew it. Lawyer attacked in city apartment. Walter. Yeah. You ask me. Here it is. New York, January 18th. Bruised and bleeding after an attack by a mysterious visitor into his rooms at the bachelor's club early last night. Wait a minute. Go on. Walter Pomeroy, noted criminal lawyer, still refused to disclose the identity of his assailant. Dr. James Penrose, attending physician, said Pomeroy suffered a possible concussion from a severe blow on the head, but was otherwise progressing nicely and would be released from city hospital in 24 hours. The attack came at... Severe blow on the head. Yeah, he fell. Listen. Listen, Maxine. This doesn't tell it all. There's something else. Then what is it? What is the matter? Okay. So you want to know what's the matter? What's wrong with me? Okay, sit down on that bench there. Make yourself comfortable, because that's it. That's what's wrong. I wanted you to know all of it, because what you're important to me now may be more important than anything else in the world. You can check out if you want to. It's nothing a cup of coffee won't cure. Max... There's an all-night stand around the corner. I've got 20 cents. The electrical part's supposed to be as good. Ask for and insist on auto light, original factory parts, at your neighborhood service station, car dealer, garage, or repair shop. Remember, you're always right with auto light. Next Thursday for suspense, William Powell will be our star. The play is called The Escape of Lacey Abbott. And it is, as we say... A tale well calculated to keep you in... Suspense! Tonight's suspense play was produced and edited by William Spear and directed by Norman McDonnell. Music for suspense is composed by Renee Garagank and Lucian Morrowack and conducted by Lud Bluskin. Four Hours to Kill is an original radio play by Harold Swanson. Robert Taylor will soon be seen with John Hodiak and Arlene Dahl in the Metro-Goldwood mayor production Ambush. In the coming weeks, you will hear such stars as Ozzie and Harriet Nelson and Rosalind Russell. Don't forget, next Thursday, same time, auto light will present suspense, starring William Powell. You can buy auto light resistor or regular spark plugs, auto light staple batteries, auto light electrical parts at your neighborhood auto light dealers. Switch to auto light. Good night. 1,600,000 men still wear the uniform of the Army, Navy, Marines and Air Force. It's good to know that the USO extends them a friendly welcome no matter where they are stationed. This is CBS, the Columbia Broadcasting System.


Alrighty, welcome back to Operating Systems. So today we are going to talk about threads implementation and how you might implement threads if you were to cough, cough, wink, wink, implement it yourself coming tomorrow. So let's get into this because this will be useful. So there are a few multi-threading models, so you might ask yourselves, well, where do I actually implement the threads? So there is actually two options, well there's actually three, but the two main ones is I could implement the threads as kernel threads or user threads. And what's the difference between them? Well kernel threads the kernel knows about, so the kernel knows they are separate execution streams, while if they are user threads that just means you are creating your own threads you are faking it. As far as the kernel is concerned, you only have, it's only executing a single thread and then you are concurrently switching between that on top of that thread. So the user threads are completely in user space, which means that they're just part of your code. The kernel doesn't treat your process any differently. So if you do user threads, your process only has that one main thread that the kernel creates and then as far as the kernel is concerned there is no notion of any other threads existing in your process. So you just create them and that is what you will be doing in Lab 3. The alternative is to have kernel threads that are implemented in kernel space. So the kernel actually knows about the threads so you would have to do a system call to create them and then after that the kernel manages all the resources for you and it can actually schedule threads separately because it knows about threads. So it could run two threads in parallel because the kernel knows about them while if you just have user threads you can't do anything in parallel because your process will only have a single main thread and that is all the kernel is concerned about. It will only execute one thing at a time. So if you need thread support it requires something like a thread table which is also analogous to process control block similar to the process table so it could be in kernel space or user space depending on if you're implementing kernel threads or user threads. So if you're doing user threads which you will be doing there is also a need to have your own scheduling system on top of it for our purposes in Lab I guess 4 you will just be doing first in, first out, first come, first serve so the easiest scheduling we could do but you could implement your own not for the test case but if you wanted to you could implement your own scheduling and take your user threads way further but in both models a process contain multiple threads it's just whether or not the kernel is aware of the multiple threads or not. So we could avoid system calls and let a thread block so for user level threads with no kernel support they're going to be really fast to create and really quick to destroy because there's no system call associated with them no context switches at the kernel level you have to do all your context switches yourself and while your program is running but the big drawback for having user threads is well because the kernel only knows about one thread running in your process if one of your thread blocks by doing a read or a write or any other system call that blocks or doing a sleep then your process no other thread will execute because as far as the kernel is concerned that process is now asleep can't execute anything else if you have kernel level threads are going to be slower to create because they necessitate a system call but the nice thing about kernel level threads is well the kernel knows about them so if one if you have like eight threads in your process if one of them does a sleep or blocks while that doesn't affect any other thread the other seven threads can go ahead and still execute the kernel could even run them in parallel if you had enough resources so all the threading libraries you run have some aspect that runs in user mode and then the thread library will be responsible for mapping those user threads to kernel threads in whatever fashion it wants so pure users pure user space threads that's what's called many to one so it's how many user threads map to one or map to how many kernel threads so in many to one that means all your user threads map to a single kernel thread so it's purely implemented in user space again the kernel is not aware that your program your process actually has multiple threads it doesn't care so if that process blocks that process just can't be scheduled anymore so the other scheme if you want one thread to map to one kernel thread that is called one to one so each of the threads in the library actually maps to a kernel thread the kernel handles everything there's just some the thread library is just responsible for doing some light accounting and figuring out you know numbers to threads and things like that so p threads are an example of one to one so they are actually in kernel kernel threads so that's why if you have multiple threads they will if i have eight threads and i have eight cores on my cpu well it could schedule them all in parallel they could all be running at the same time because they are kernel threads there is another option and that is many to many so i can map a bunch of user threads in the library to one or more kernel thread generally there's more user level threads and there are kernel threads and you cap this at the number of kernel threads that matches your hardware because anything on top of that can't really run in parallel so that is another option so like i said many to one pure user space implementation the kernel is only aware of a single thread and everything is on top of that so this is what you will be doing in lab four so it's going to be fast going to be portable doesn't depend on anything it is just a library but the drawbacks are if one thread blocks all the other threads block because all the operating system cares about is scheduling that one thread it knows about in the process also like i said before nothing can be done in parallel because at the end of the day your kernel is that like a gas leak okay it stopped we are saved all right whoo all right so in this case we can't execute any threads in parallel because again the kernel only knows about that single thread so if one blocks the whole process blocks the other one again like i said harpy on this one to one just uses a kernel thread implementation so there's just a thin wrapper around some system calls to make it easier to use and this is essentially what the p thread library does so that allows you to exploit the four full parallelism of your machine the kernel can schedule each thread on a different core run them all in parallel which we learned what the difference between concurrency and parallelism is on the last one so it could run them all in parallel but it has to use a slower system call interface and you lose some control so if we are doing a pure user thread library while you actually have some say with the scheduling but if you're doing the kernel version of it you don't have that much control you have as much control as with what we saw before with the process so you might be able to adjust your priority a little bit but ultimately you have no control over the schedule so typically this is the actual implementation that's used and this is what we'll assume for linux using p threads so many to many is a hybrid approach and the idea is while we have more user level threads than kernel level threads so I will cap the number of expensive to make kernel level threads to match the number I could actually run in parallel on my machine and the idea behind that is you get the most out of your cpu and your system with the fewest number of system calls however this really leads to a complicated threading library it tends to be popular for a while and then die out and then come back so recently it has come back if you're using java so java virtual threads use this idea typically it's really complicated to get right because any of these threads could also block and if one of the threads blocks whatever is mapped to that one kernel thread would also block so sometimes you might not want that you might get really weird performance and you could block a lot of threads one execution you know you might get lucky one you might not so typically it's really unpredictable and hard to get right and people generally avoid it yeah yeah so the minimum number of system calls so say I wanted to create like a thousand threads well if it was one to one I would have to do a thousand system calls for each kernel thread if I did many to many I might just make a thousand user threads and then if I only have eight cores on my machine I will only make eight kernel threads and then I'll figure out a mapping from those thousands split them up into like what 125 each something like that but the drawback is well if one of those 125 block that's running on the kernel thread the other 124 that are also mapped to that kernel thread will also block so you might get typically this comes and goes with the time apparently it's new again so if you see java virtual threads their new feature that's what this is and I would avoid to use it I would avoid using it so threads we haven't even talked about how they would complicate the kernel so for example if I have multiple threads that are running and they're kernel threads what should happen when I fork so if there's eight threads running and I fork what happens do like the new process is an exact copy do they just that new process also has eight threads and it's just whatever state they were in when the copy was made how would that get out of hand really really quickly well remember that I could essentially accelerate that fork bomb so if I had like a thousand threads and then I had each of them doing like a fork bomb thing well then I multiply it really really I multiply it even quicker than I did before so the rule behind that is actually a fairly simple rule so whenever you call fork in a process with multiple kernel threads well Linux is only going to copy the thread that initiated that fork call so your new process will only have a single thread and that single thread will be a copy of the thread that called fork so if I have eight threads and one of them calls fork I would create a new process with only one thread and it would be a copy of that thread that called fork so my new one my new process would continue on with only a single thread and because of this well if it hits p thread exit and it's the only thread in the new process it would just exit the process because it is the only thread available now so it will go ahead and call p thread exit and all that as far as I can tell there's also p thread at fork which we will not cover in this course because as you might imagine if one thread is calling fork you don't know what the others say seven threads are doing so you might want to make sure your program is in some type of consistent state so that that new process is consistent whenever it gets forked so you're allowed to control you're allowed to control what happens out of fork using p thread at fork to make the state consistent and again that will be too complicated not covered in this course with how to do that and make things consistent but you should know about its existence and that yeah it's probably a giant headache yeah and what sorry yeah so if I have eight threads and then one of the threads calls fork it will create a new process that is a copy of the old process so like we had before but the new process will only have a single thread in it and it will be the same thread that called fork if that kind of makes sense if not we'll have an example we'll come up with an example so also we have to think all if I have a process with eight threads and a signal gets sent to the process what should happen so which thread should receive the signal should it be the main thread okay well if the main thread doesn't exist anymore should it be all threads will well then each thread tries to do the same thing so you might be doing the same thing eight times so the linux solution to what happens when a signal gets sent to a process with multiple threads is to just send the signal to one of the threads which one of the threads yeah it just picks it at random so it will just randomly send the signal to any old thread you don't get control and this makes concurrency hard because any thread can be interrupted at any given time due to signals and this is mainly this is another reason why people actually do not like signals so that's fun so another thing is well you might think that many to many is actually a good idea so what you can do instead of implementing a whole threading library on top of it you can use something called a thread pool so because remember the goal of many to many is only to avoid the thread creation costs avoid the system calls so if I only have eight cores on my machine I can just create something called a thread pool of eight kernel threads and then you you can just have a queue of tasks and then each thread can just grab a task off the queue and just do the work as long as there are some tasks to do so you can actually run up to eight things for example in parallel and with only creating eight kernel threads so as requests come in you might wake up the thread tell them they got some work to do and then they can go back to sleep and if there's no work to do they don't have to run so you might see this once you get into like if you start caring about performance on your machine you can use something like thread pools in fact in python there's like you can look up thread pools in python you can use thread pools in python so that is a good way to make your programs run in parallel so like I said lab four you're going to implement main to one and this state diagram may help you because your threads are going to follow the same state so the library you're going to create is called what or wacky user thread so I'm easily amused so I just made a three letter acronym that I don't know amuse me somewhat so whenever you create a thread you're going to create your own thread through a function called what create so that should create a new thread for you and put it in this waiting state or ready state and since you are doing user threads only one thread can be running at any given time so eventually whenever you do FIFO order it will be running and then we're going to do cooperative threads so they can actually yield which would mean that they can you know go ahead and put themselves on the back of the queue and another thread can run so you will have an explicit call to yield that will put the current thread back into the ready queue and essentially make sure that the next thread is going to run so it just context switches to the next thread and that will be done through a nice helper library that we will explore in the next lecture so you don't have to do any of the hard context switching most of the heavy lifting is done for you so while a thread is running it may become terminated by calling exit so that would make that thread terminated and in which case while you would have to go you would not clean it up you would set its status code and everything like that and then start running the next thread if there is another one to run if there is not another thread to run while this should just exit the process like we saw before with p threads you will get into the situation where some threads can block so you are going to implement join so you are allowed to join another thread so in that case whatever thread calls join will block until the thread it is trying to join actually terminates so that will block the thread and then what whenever it terminates we'll have to go and take this block thread and then put it in the ready or waiting queue whenever the thread it's waiting for has terminated so this is what you'll be juggling in lab four so this is like a vastly simplified version of old the old lab that took like 80 hours so this one should not take that long if this one is like super daunting please I haven't seen any feedback for labs or at least the last lab so please use the feedback channel if you have any comments or anything like that this lab however shouldn't be too bad yeah yeah can we get another help video for that lab and that's the next lecture so next lecture we will be doing a real video so I'll show you how to do all the context switching and everything like that I'll show you how to do a queue so there'll be a queue you can use you don't have to implement your own and I've from last year I updated the documentation added some more help things and they'll also be incentive to start early because you get to write a test case and you have a week to do it so you get to see how it works to encourage you to you know actually try it all right so with this your sketch oh yeah yeah so you can submit a test case just and you'll have a week to do it and it's like worth like five percent or something of the lab so a very minimal mark if you want to forget it it's mostly so that you know what it is so you get to write a test case that does whatever you want and it runs against the solution and you get to see the proper output of it so if you are confused about anything you can write a test case for it and then I will run the solution on it and then tell you what the output was so you'll be able to tell exactly what it should do and you can do that without actually implementing anything we'll see examples of it and I'll update the documentation so that it has some code examples too all right so for the scheduling could be round robin or first come first serve in that you just create a queue or a list and it's a fairly simple algorithm so run whatever the thread is at the front if it yields throw it to the back of the queue in this lab you have to do the context switch and it will have to save all the registers and everything like that but there is a handy dandy library that I will teach you to use in the next lecture that will do all the heavy lifting for you so the threads you are implementing are going to be cooperative threads so that means that they have to be nice and they have to yield in order for another thread to run but if you want to extend your implementation to do preemptive threads it's actually not that much it's not that difficult all you would do is get like a timer signal and then whenever that timer interrupt comes into your process you just call yield for that thread so then you just constantly change it over and over again so here is our next complication then we can ask questions and explore do whatever so let us explore this fun little program because this is when things get real so here we go so we have a main so once we start executing this we'll create a single process with the main thread that starts executing main so what it is going to do is create an array of p thread t's up to num threads which in this case is eight and then we will have a for loop that will create eight threads and then set them all to execute this run function and then after we create them all we're going to join them all from the main thread so they're all joinable so I will let the main thread go ahead and wait for all eight of them to finish and then I'm going to print a counter what is counter I'm glad you asked so counter is a global variable so the only static here if we forget what static means it's just a global variable that I can only access in this .c file otherwise static doesn't do anything so all my run function does is each thread will loop 10,000 times and increment the counter by one for every iteration of the loop so let's do some quick math here if I have eight threads and they each increment that counter 10,000 times what should that counter be when I'm done executing yeah 80 80,000 right so each thread adds increments at 10,000 times I have eight threads eight times 10,000 is 80,000 so we would all agree that that's 80,000 should be 80,000 cool all right so let's compile 73,000 73,373 let's try it again 62,000 yikes 76 there our program works no bugs right it's 80,000 that's what I expected no now works I fixed it I just had to run it a few times so if I run it a few more times you know I get oh I get 80,000 again 68 so imagine if this program was calculating your grades or something like that oops sorry you got like a you got a 62 instead of an 80 oops so anyone wants to try and explain what is happening here yeah oh that's a good guess it's not waiting for everything to finish so is it waiting for everything to finish so it must be waiting for everything to finish right because I'm waiting for so unless I screwed up the loop bounds which I didn't so this executes the same amount times as this so for each thread I create I join it yeah yeah they're sharing memory right so the only thing that is local to a thread is well essentially it's stack so like this eye is going to be unique to a thread so each thread is actually going to execute 10,000 times but this counter is a global so it is shared between all threads and this is why they have harped on you the difference between the heap and the stack generally to prepare you for this and the low level pointer stuff was not an accident it's because the details actually matter here so we'll go over this more later but just so you know if I do plus plus count and count is a global variable well this operation doesn't just happen in one step so what your computer actually has to do is well each thread is going to read from the address of counter I guess it's called counter so it would do a memory read from that address and it would read from that and then put it into a register and then the next thing it would do to implement plus plus counter is it would increment that register whatever it happened to be and then the final step if it's a global variable well it would have to write register value to that whatever the address of the counter was so there's actually three steps for that plus plus count so I have to load the value from memory put it in a register increment it increment the register and then I have to go ahead and then write that that new updated value back up to update that global variable so what can happen and don't worry if this is confusing right now this is the heart of the hardest part of the course so don't worry we will go over it many a times but what can happen even with two threads well say I have two threads that are each trying to do this so I could have the first thread read from counter so I'll just make it slightly shorter into register so in this case let's assume that counter is originally counter gets initialized to something like zero so in this case thread one will read zero into some register value so the register is now equal to zero then in the next step it would increment that register so now register is equal to one and then it would write two counter from that register so now that counter global variable is now one and then ideally the exact same thing happens we could switch over to thread two and then thread two could read from counter in this case it would see the new value of counter so instead of reading a zero it would go ahead and read a one and then it would increment its register so it would increment it to two and then it would write to counter and then counter would be equal to two and life is good right two threads each increment one so it should go from zero to two so any questions about that that's how it would normally work yeah yeah so this is whatever it switches between threads did you have any say as to when the kernel will context switch between processes no so you have no say whether or not the kernel context switches between threads so because of that well this is what would happen in the ideal case but in the not oh yep yeah so in the not ideal case whoops so in the not ideal case well thread one could start running read counter into its register and then we context switch to thread two in which case it would read from the same global variable and in this case it is not updated so it's going to do exactly what you said and thread two is going to read zero right now at this point we are screwed so no matter what happens if it switches back to thread one well thread one with it so the register is local to the thread so it's already loaded as zero so it won't change whenever we context switch back to it we would increment it from zero to one and then we would write out to that counter and then counter would be updated to one then if we context switch back over to thread two well its register was zero it's currently zero it would do that increment and if it does that increment well it would increment it from zero to one and then it would also update the counter and in this case it would be updated again to one so I would see one when both threads actually update it so instead of what I would expect one thread writes one the other writes two if I get unlucky well then one may write one and the other may write one as well and just overwrite it so this is like the crux of our problem and it is called a data race and you will learn how to fix these and this is it this is like the hardest thing data races are like the most notorious hard hardest bugs ever to fix and it and we'll explore why as we go on we'll need several lectures to actually cover it and how to defend against this but does everyone understand that this is fairly bad so it just turned out that sometimes I got really lucky how I got 80 000 but you know oh hey luck again but turns out I'm not always lucky oh whoops so turns out you know 60 000 that's a unlucky one 70 000 ooh 50 000 yikes real bad 80 000 they're fixed yeah so this is like the reason why programming is actually hard all right any questions about that stuff are we fairly good I didn't break you too bad yet yeah well if I wanted to let's say oh yeah okay someone tell me how to fix this so it always prints 80 000 but we still create eight threads anyone come up with the solution yeah sure like I want to sleep here here let's try this this all right so if we learn anything so far it should be that sleeping and it just working is not a solution so it might work for some things it might not work for others so in this case let's try it oh this is going to be real slow all right all right so this is already not not satisfying okay that got lucky this is very not satisfying yeah either we don't know about mutexes yet yeah yeah so I could create an array of these and then have each thread just update its own so that I essentially make some thread local storage for each one and then I would probably have to add them all together at the end right to sum everything back up so you actually just came up with map reduce so map reduce it's like a big data google thing you won't learn that until like fourth year so that is one thing we could do but I don't want to write that many lines another yeah so do this all right let's see eight thousand seems pretty good so this kind of fixes the issue but what am I losing by doing this yeah so this is essentially just running it in serial so I create a thread it executes I wait for it to finish I create a new thread wait to wait to finish create another thread wait for it to finish so at any given time there is only one thread doing this right so if I have eight cores on my machine can I use all eight cores in parallel no so if you want things to go vroom vroom fast and you want things to run in parallel well we're going to have this issue but this is a fix that will give you the correct outcome you want but at this point is this a smart idea probably not it's probably going to be a lot faster just to have one thread that doesn't create anything else and just loops 80 000 times instead that's probably going to be a lot faster so you will encounter that whenever you try to like add threads to your applications you might get into the situation where oh well I'll fix all these problems by just essentially running it in serial and then suddenly in your desire to make your program go a lot faster you have now just made it slower you've made it still serial but you've made it create threads and use threads on top of what it was already doing so you can actually make things go slower by using threads so any other questions that's fun all right so we'll be doing threads for a while now so we can go ahead and early or yeah this is we can end early we can take a break have a nice little breather finish your lab three uh if you haven't done so already and then be sure to come to the next lecture because we'll be doing like how you should start lab four and how you should use all the libraries you should be using so just remember going for you we're all in this together and this again hardest thing in the course


Hey guys, welcome back to my YouTube channel Daniel Rosal here trying to make life a little bit easier if you are living and working in Israel Especially if you are charting the unusual past of an at my or self-employed person through life I'm going to be doing a YouTube video later about all the various different bodies one needs to remain compliant with Doing this but what I want to do cover in today's video is how to use the self-service pages for paying your tax Now I'm not an accountant, but I have been doing this at my eating for Five years, so I'm pretty familiar with some basic things and I can definitely give some non Taxation related advice as to how to use these tools the best thing you can do today To help yourself in Israel besides learning to speak Hebrew and very much a work in progress for me By the way is learning to type in Hebrew such an invaluable and under taught skill out there Now there's two different. So I've typed into Google here Tash loom mass Harknessa pay mass Harknessa and you can see there's two Different search results and these are two different payment portals. The first one is touch them a mass Harknessa This is like a general payment page if you need to pay them for various reasons and the second one It says here in Hebrew the boy with touch loom McDameau mass Harknessa, okay, so the first one and I hope this is gonna work Yay, it works. I had a bit of trouble because they have pretty tight security and if you've already logged in on the same session They'll stop you logging in. So that is successful. So I just clicked through that government page Which tells you basically what you're in store for now This one the second one is diva wach the touch loom make them out mass Harknessa Make them out are pre payments for tax. So whether you're an OSAC Paturo or an OSAC Moshe You make these payments six times a year in other words, it's a two-month period and According to the rate of tax you've set with the tax authority You report how much money you've made Multiply by that taxation amount and then you make a prepayment them when you do your tax return the following summer They reconcile whether there is whether they owe you money or you owe them money But this is designed to make it a bit easier In the notes section in Hebrew Haarot, you have the deadline so it says here a Report that is submitted until the 19th of the month at 8 30 Israel time will be considered to be a timely report And if you miss that deadline the 19th at half 6 Israel local time You're going to be potentially liable for a fine So you need to I would recommend setting a recurrent Google Calendar link for the 19th Empirotically check if they change the deadline same thing for for the mass reports So this one this first URL that I'm just drawing your attention to it. I'm not actually going to go into these systems I would recommend strongly bookmarking both of these webpages The first one allows you to basically generally pay masach nasa In general, you can see the boxes here for you can do a for a a predicted bill For the previous year, there's an option here to pay off your fines And there's also just a general payment So this is like if you get a letter from the tax authority saying you owe x amount outside of your usual returns You can use this to pay the money after you put in your miss Bartik your Your file number and your email you'll be able to pay via credit card or bank transfer It's a great very well-done system. So this is here at the top of the page here She'd do her touch loom a mass. I thought it's I think a she'd do her not mistaken is just another word for a system Payments of mass. I can say and you can actually jump to the other link here. Do you work for touch loom mcdomot? By doing this and the ma'am system is on a separate URL again So if you're an OSAC Moshe and you have to pay submit Ma'am reports vat reports every two months and pay them you need to bookmark another URL in addition to To these so this is the the second URL that I got just researching is for the Mckdomot payment. Okay, so this says divo off a touch loom mass. I can say I was not Alpine as green wish time. So this is reporting and payment of mass. I can say of Employment tax income tax for the year 2022 and it requires Three fields. Firstly, you're Miss Bartik your file number Secondly, you're miss par see Dory and this is a number. This is a number you'll get from the tax authority and Thirdly, you need to put in your email address. Now as well. It's the same deadline here. So that's important to know TV Until the 19th at 6 30 will be considered timely So I changed my mind about not going in and I said it actually give you guys a peek into the exciting world of the Tax prepayment system, but I'm going to just use a bit of filtering To protect my personal information And this is what it looks like when you come inside basically you get a this figure here 9.5% That's something you agree with the tax authority. How much your percentages are supposed to be I think I need to update my figure and it's got this little calculator here So you put in your amount and it does the mathematics and you can click on the cheshuv but in here that means a neighbor in in in Hebrew I'm losing my English vocab calculate and based on you can read what exactly all these things do and That'll give you your a calculate how much you owe then if you click on to the next button Now I'm actually not going to do this because I've already submitted my payment, but it's pretty pretty much as the previous screen worked You get to this page where it links off to the various digital banks and you can pay directly So this is a pretty good system. I recommend doing it online and not bothering with going to the post office Etc. There's a very similar system in place for reporting your ma'am That is that it's if you're an OSAC Moshe you have to report your ma'am You also have to fill out a report save a report Make sure whatever you do on these systems to click on the download PDF option or print a PDF Keep a record of every single report you submit to the tax authority and to the income tax authority For for in other words from as a concern from ma'am and these systems are very easy to use if you do get stuck Or you lose some credentials. They do have a support team so you can reach out to them And even it you can use a system even if you're working with an accountant for bookkeeping You can use a self-service system yourself. Hope that video was somewhat useful If you're self-employed in Israel and trying to navigate all these delightful Online interfaces if you want to get more videos for me, please subscribe to this YouTube channel