Ok, Shoshanim, let's start with the most important part of the video. This. This is a mug I have received in the cold therapy seminar in Tunoseverein in Romania.  Ok, enough with the nonsense, Vaknin. Onward, Jewish soldiers. I'm Jewish. So, my name is Zambaknin. I'm the author of Malignan Sir Flav, narcissism revisited the groundbreaking Bible of narcissism in the book that coined the phrase narcissistic abuse. I'm also a professor of psychology in several universities. Yes, that's me. And today we are going to discuss cheating and triangulation, cheating as in adultery.  But actually we're talking about a good old-fashioned cheating and its second cousin, triangulation. Why do people do that? Why do they cheat? Why do they triangulate? We're going to discuss two cases. We're going to discuss cheating and triangulation in an obsessive-sick relationship. And we are going to discuss cheating and triangulation by the narcissists. These are two case studies put together. They cover a big portion of these behaviors. They explain, they provide a theology for these behaviors. We start with an abusive couple, a sick couple, a couple founded on mutual obsession and compulsive acts. This is a couple with both members of the couple hurt each other, abuse each other. Both members of the couple seek to inflict pain on the other because this is the only surviving mode of communication. I recommend that you watch the amazing movie Who is Afraid of Virginia Woolf. It's about such a couple. Now in this couple power dynamics are mediated via pain. So the members of the couple use hurt, use betrayal to actually communicate to each other their places in the hierarchy. And it's ever shifting. The partner who inflicts pain is on top and the injured party, the party who is in pain, is at the bottom and then it reverses via revenge dynamic. So we're going to discuss this kind of couple right now. You all know such couples. Couples where there's a lot of verbal abuse, physical violence, actually nothing but verbal abuse and physical violence. And yet the members of such couples are unable to walk away. They can't find within themselves the resources to break up, to put an end to it, to somehow move on. There is something in this dynamic that proves to be addictive. There is an inability to regard the couplehood, regard the togetherness as toxic and pernicious or even when the members of the couple realize how bad it is in the couple, they just can't say goodbye. They can't separate. Something sinister and dark and nefarious is binding them together, usually their pasts wounds inflicted on them in the past early childhood traumas. And so today we are going to discuss all this in the context of cheating and triangulation because cheating and triangulation are relationship management tools in such couples. They use these tools, they use these behaviors to actually signal to each other, to establish hierarchy, to win the power play at least intermittently and then the cycle starts all over again. So some people stray, some people have sex with other people outside the couple, outside the diet, actually in order to preserve the couple, in order to preserve the partnership, in order to persevere, in a long-term obsessed, utterly sick and abusive relationship, they don't cheat to exit the relationship, they cheat to cement the relationship, to get a rise out of the partner, to re-evoke and re-invoke and revive and resuscitate emotions to somehow signal distress to the partner. Or on the very contrary, to tell the partner, I don't need you, I have alternatives. This is all about the other member of the couple. The cheating and the triangulation are not about other people, they are not about the casual and external sex partners, they are about the primary partner in the primary relationship.  Number one, to exact revenge, you cheat, I cheat, you ignore me, I cheat or I triangulate, you hurt me, I'm going to hurt you where it hurts, I'm going to cheat on you, I'm going to triangulate with other people and I'm going to make it ostentatious and visible and if you miss, if you miss the point, I'm going to communicate to you what I'm doing and what I've done in order to witness your agony and so revenge is a major motivation in such couples, but it is not the kind of revenge that leads to the dissolution of the couple, it's a kind of revenge that leads to a strengthening of the bonding and the attachment between the members of the couple, the revenge signals love, the revenge is perceived as you've hurt me, you hurt me and I'm going to hurt you back, but you have the power to hurt me because I love you, so in some sick twisted way, revenge cheating is actually proof of love, same as abuse in these couples, abusive behaviors and excessive romantic jealousy, for example, which leads to abusive behaviors, they are all perceived as affirmations of deep, profound, everlasting love. In other couples, such behaviors would lead to the instant disintegration of the togetherness to both members walking away from each other, but not in these couples, in these couples, the worse it gets, the better it gets, these couples feel good only when they feel bad, they feel alive only when they're in pain, and so in this sense, cheating and triangulations in this obsessive-compulsive, sick, pain-oriented couples, cheating and triangulation in these couples is a form of self-harming, self-harming that reminds them that they are alive, that drowns the pain inside them, self-harming that is intended to somehow revive dynamics that had been moribund or stale for too long to forestall, actually, abandonment and rejection. I have cheated on you, you have to reclaim me sexually and otherwise reclaim sex, and so revenge is the first motivation. The second motivation in such sick couples is to restore a power symmetry within the couple. Acts of cheating and triangulation, acts of betrayal, are perceived as one upmanship. The party who betrays is on top because he has the power to inflict pain, so the other party, the injured party, the damaged party, the broken party, the suffering and writhing party, the agonizing party, that party has to restore the balance somehow, somehow it has to re-establish, this party has to re-establish some symmetry within the relationship, a power distribution, a power matrix that is equitable, and so the only way to do this is to cheat and to triangulate. That's the second motivation. The third motivation is, of course, to cater to unmet emotional and sexual needs. In such couples, usually, there is a deprivation of needs. There is a deficiency in fulfilling needs, and so the cheating and the triangulation are short-term fixes. It's like self-medication with the bodies of other people, and once self-esteem had been boosted, attention had been given, compassion and affection had been afforded, there's no need for the external partners anymore. They are used and discarded, and now the party, the cheating party, is ready to revert, to return, to the primary, sick relationship. And finally, and perhaps most importantly, the fourth reason people in such relationships cheat, such dysfunctional relationships, white people cheat and white people triangulate, is to affirm, to confirm, to buttress an internalized bed object. The bed object, actually, is the disparaging partner's point of view. In such relationships, where mutual sickness is self-reinforcing and other reinforcing, where archaic wounds resonate, to use the freziology of Sigmund Freud and Johann Lachkar, the vispo, the vulnerability spot, in these couples, where the main activity is to wound each other where it most hurts. The main activity is to re-traumatize the other partner, to remind the other partner of early childhood traumas. The main activity in these couples is to destroy each other, to gratify each other's self-destructiveness and self-defeat. So in these couples, the partners give each other drugs, or they cheat on each other ostentatiously and visibly. They do things to destroy the other partner. And so the message given to each other in such couples is, you're a bed object, you're unlovable, you're deserving only of pain. And it reaffirms early childhood traumas, where pain was connected to love, pain inflicted by parents who were supposed to love. Children who grew up in such families learned to identify love with pain. And when pain is absent, they believe that they are not being loved. So such children, when they grow up and become adults, they will try to provoke the partner to hurt them, so that they feel loved. They misidentify pain with love and with pain where pain is missing.   And one of the reasons for cheating and triangulation is to confirm to the other partner, yes, I am a bed object. I am corrupt.  I am unreliable. I am untrustworthy.  I am deceitful and hurtful and hateful and bad for you. Exactly as you said, you are right. I'm confirming your point of view, dear partner.  It's a form of self-destruction. It's a form of self-punishment for being a bed object. Such promiscuous, unboundary and sexually self-trashing behaviors typically follow a period of loyal faithfulness. All relationships, all of these six relationships start actually with a period of love-bombing and extreme faithfulness. All other men and all other women cease to exist. The focus is intense, laser-like. There's only one person in the world.   And so there's an exclusion of all others in every meaningful way. And so initially these relationships, which are essentially destructive shared fantasies or shared fantasies of destruction, in these relationships, they start with extreme loyalty, sexual loyalty, romantic loyalty and emotional loyalty to the partner. Total faithfulness, no straying, no cheating, no triangulation, not even contemplating another person. But then this is met with traumatizing rejection, with abandonment, with ostentatious cheating and infidelity by the partner.  Once the initial phase of faithfulness and loyalty is disrupted by one of the partners, both of them descend into dysfunctional, sick, hurtful behaviors, behaviors which are intended to damage both the other partner and oneself. And whenever such people are offered intimacy by their partners in crime, so they cheat with other people. And when these other people offer them intimacy, this is, it shocks them. For example, if they cheat with someone and that someone would say, stay longer, sleep over, let's meet again. This is an offer of connection. This is an offer of intimacy. This is potential for a new relationship. So when these external partners actually try to capitalize on the cheating or the triangulation, to start a relationship or somehow to render the whole interaction more human and intimate, the cheater reacts aggressively, they recoil, they hurry back to the primary partner to reaffirm the dysfunctional bond. So the dynamic is this, in destructive and shared fantasies which revolve around destruction, self-destruction and other destruction. In these shared fantasies, both partners cheat and triangulate. They cheat and triangulate, of course, with external partners, with others, extra-diadic partners. When these external partners, when these other people outside the couple want to push the relationship further, they want to move from a one-night stand to a potential relationship. They want the cheater to sleep over. They want to meet again, etc., etc. The cheater panics. She recoils. She becomes aggressive. She runs away. She blocks the external partners. She hurries back to the primary, to her primary partner because her primary partner is her only partner. The external partners, the men and women who she uses or he uses to cheat with, these are mere instruments. These are objects. In sick relationships, when either of the two partners cheat, they cheat with others by instrumentalizing them, by objectifying them. They use bodies of other people. It's like they cheat with someone in order to regain the primary partner, in order to regain the love and affection that they have had at the beginning of the relationship. They don't care about the people they cheat with. The people which they cheat with are instruments, they're objects, they're nobody's, they're nothing, they're meaningless. And even if these people are actually good, they try to start a relationship or go further, this will never happen, because the cheating and triangulation are about the primary partner. The cheating and triangulation are for the sake of the primary partner. The cheating and triangulation are a message to the primary partner, very often a cry for help, a signal of distress. Look, look at me.  And I'm doing it, and it makes me feel guilty and ashamed. And I regret it, and I hate it, but I have to do it.  I just need you to love me again. So this is all about the primary partner. And so the people that the people who serve as instruments, objects in the cheating process, and in the triangulation process, not always, but often feel used and abused. They feel bad about what's happening. They feel that they somehow were co-opted into a theater play, which is not their own. They feel that there were tools in every possible sense of the world. They feel that they were kind of unwilling participants, participants in someone else's script. They realize that they've been somehow used to re-establish and resuscitate another person's relationship. And they feel really, really bad about it. Such a relationship dynamic in these sick couples is also conducive to an inversion of traditional stereotypical gender roles. Women in such relationships become sexually predatory as they keep hunting for men to cheat with. And they cheat with these men, not because they're looking for a relationship. They cheat with these men, usually one time, to signal something to the partner. So they become heartless. They become hard and cold and predatory and hateful of men. They become very men-like in their psychosexuality. They become goal-oriented. They're focused on the sex and eliminate any hint of motion or connection. They become very masculine in the traditional stereotypical sense of the word.  They become more dysregulated, emotionally dysregulated, for example, by the cheating and the triangulation of the other partner. So the partners in these sick dysfunctional relationships induce in each other a gender role reversion or inversion. The female side becomes more masculine. The male side becomes more feminine, but not in the good sense of the word. They become more psychopathically masculine and more dysregulated feminine. The sicknesses or the pathologies of both genders permeate, pervade and invade such relationships via the acts of cheating, hurting each other, causing pain, triangulation and so on. And this is especially with the case when both parties have mummy or daddy issues. Unconsciously, they're actually trying to emulate and imitate the abuser.   She would vow to herself, I would never be abused. I will become the abuser. If someone hurts me, I'm going to hurt back. If someone causes me pain, I'm going to cause 10 times the pain, then I'm going to do it ostentatiously, visibly and cruelly. She becomes an abusive man. Similarly, a man who has been exposed to a dead mother, an absent selfish instrumentalizing parentifying depressive mother, for example, absent mother, such a man would have mummy issues and he would tend to react with extreme dysregulation to the pain inflicted on him by a female, a mother figure. So mummy and daddy issues are provoked in such couples by the cheating and the dysregulation. Okay, let's talk now about the narcissist. Why do narcissists cheat on their spouses? Why do they commit adultery? Why do they have extramarital affairs and liaisons? The answer is not as simple as it sounds as opposed to, let's say, typical people, normal people, healthy people who are presented with opportunities to cheat and succumb to temptation. It's a normal process. With narcissists, as usual, the picture is much more complex. Some narcissists cheat or triangulate because they're simply looking for narcissistic supply. The somatic narcissist, for example, he resorts to serial sexual conquest because this is his narcissistic supply. The second reason is that exactly like psychopaths, exactly like psychopaths, narcissists are easily bored. They have a low boredom threshold. They're novelty seekers. They need new things all the time and they have a low tolerance for boredom. Sexual dalliances kind of alleviate this nagging and frustrating and weak. The quest for novelty, for diversions and thrills, the kind of having a vacation for one's own life is combined with a journey of self-exploration and discovery that involves filling in the gaps, self-actualization, self-realization and fulfillment in the narcissist's biography. The narcissist has a kind of missed childhood and delayed or arrested adolescence, so they tend to recycle old flames and so on and so forth in order to discover new aspects of their personality. The cut the long story short, cheating in the narcissist's case is often an attempt at separation, individuation from the primary partner. Number three, narcissists maintain an island of stability and a focus of stability in their lives but all the other dimensions of their existence are chaotic, unstable and unpredictable. So this is what I call the twister formation and it serves many emotional needs and I discuss all of this in other videos and so a narcissist for example may be a model employee. He may climb through the corporate ladder and after 40 years become the chief executive officer of a company, stable in the same company. That's his island of stability, the pursuit of a career path over decades but at the same time he would cheat on his wife like a hundred times and he would fritter the savings away and he would have dalliances and liaisons and affairs and just one right stands and so on almost almost like a sex addict. So the narcissist is an island of stability surrounded by a a roiling ocean of instability. It could be the reverse of course.  The fourth reason narcissists cheat and triangulate is that they feel they feel superior, important, unique and therefore they're entitled. They're entitled to special treatment but they're also entitled to be above the law, above social conventions. They have a right to engage in behaviors that are frowned upon by society and considered socially unacceptable to others. Others are lower level humans and narcissists are superhuman and he has the right to behave in any way he wishes. Narcissists reject and vehemently resent all limitations and conditions placed upon them but their partners. He will not tell me what to do. I'm a free man or woman.  Narcissists act on their impulses and on their desires unencumbered by social conventions and strictions. In Freudian terms we would say that narcissists and psychopaths are 100% id, 0% ego, no super ego. The fifth reason for cheating by narcissists and triangulation by narcissists, the fifth reason is a bit more complex and a bit deeper has to do with social trends, social dynamics and social structures. Marriage, monogamy and childbearing and rearing are common activities. They characterize the average person. Everyone in his dog gets married and have children sometimes. So this is like a common act. The narcissist feels robbed of his uniqueness by these pursuits. He feels that he's coerced into a relationship. He feels that by having by being loyal or by being faithful is actually succumbing, is giving up his rights. He feels that he is being reduced to the lowest common denominator, is becoming just an average joe when actually he's godlike. So husband, father, loyal partner, that's for other people. That's for the voypolloi, that's for the great unwashed, that's for the common sheep or sheeple. The narcissist is above all that. He should never be subjected to these demands. They reduce him, they minimize him, these requirements, these social conventions. It's not okay. This is narcissistic injury. To tell the narcissist you shouldn't cheat. It's not okay. No one does this. It's narcissistic injury because no one does this.  The narcissist is almost perfect. So it leads him to rebel and reassert his superiority and specialness by maintaining extramarital affairs or extradiatic by having extradiatic sex. The sixth reason is that narcissists are control freaks. Having a relationship implies a given take. It involves negotiation, it involves compromising, honest communication, a training of compromises which the narcissist acutely interprets to mean a loss of control over his life. When you compromise with someone, when you negotiate with someone, when you're forced to listen to someone, you're giving up control to some extent. You're kind of a demercy of your interlocutor or partner. Narcissists would have none of this. To reassert control, the narcissist initiates other relationships, other encounters, sexual and emotional in which he dictates the terms of engagement. Love affairs, one night stands, whichever the case may be, it's a sense of liberation. It's a sense of self-control. I'm doing exactly what I want. No one will ever tell me what to do. And finally, narcissists, of course, are terrified of intimacy. They have an insecure attachment style. Their behavior is best characterized by what Freud called approach avoidance repetition, compulsion, diathesis in Adlerian terms. Adultery is an excellent tool in the attempt to retard intimacy, to inhibit intimacy, to destroy intimacy. When you cheat, when you triangulate, it's very difficult to rebuild and reconstruct the ruined intimacy. And so as far as the narcissist is concerned, cheating, adultery, triangulation are less threatening modes of interaction. They are fuzzy. They're open-ended. There's always an exit or an exit strategy. He can always run away. And narcissism is about running away, running away from our internal reality and running away from any external reality that reminds you of your internal reality. Narcissists typically claim that they have cheated in order to put this spark back into the relation with the spouse or the primary intimate partner. They say, I did this to put some spice into the relationship, to put, to reignite it somehow. Of course, they leave it unclear. They live, they don't clarify how an act of betrayal and faithlessness can rekindle the ambas of a relationship founded initially on trust and sexual and emotional exclusivity. This is left conveniently unsaid. In the wake of an affair, the narcissist possesses the perfect alibi. If he does try to revive this sex life with his spouse and he fails, he can proudly claim, I left no stone unturned. I even went as far as cheating on my partner, all in order to resurrect our bond. And if he doesn't try to reanimate his sex life with his spouse, he turns it around and he says, this is proof that the relationship was doomed and dead to start with. And what I did was therefore not cheating.  There are two types of triangulation, first of all, to define triangulation. Triangulation is when you use a third party to manage the emotional intimacy and transactional aspects of a primary relationship. You can use a third party in any way. You can flirt with a third party.  These are all forms of triangulation. If the third party is merely an instrument and an object, if there are no emotions or attachment or bonding or connection involved, so this is triangulation. There are two types of triangulation, breakup triangulation and restorative triangulation. Breakup triangulation involves overt and ostentatious cheating, one way or another, with a third party in conjunction with other egregious misbehavior, for example, humiliating a primary partner in public. The aim of breakup triangulation is to irrevocably break up with your current partner. It's like escalating misbehavior to the point that your primary partner will initiate the breakup and you will feel blameless. So why triangulate rather than outright terminate? There are many reasons, myriad, revenge, rage, community property, inability to let go, codependency, restoring the cheater's self-esteem, feeling desirable and alive again, obtaining succor and exalt's intimacy, or uncertainty about one's true wishes. All these are reasons for triangulating, but usually it is simply the desire to cast one's mate as the villain who ended the relationship, because it's very difficult to take responsibility for ending a relationship, more difficult than you think. About 69% of all divorces in the United States are initiated by women, and yet most of these women claim to have been traumatized by the breakup itself. Many people, especially dysfunctional people, abusive people, mentally ill people, they want the partner to do it. They want to push the partner to the point of no return. The partner would say, well, we can't be together anymore. It's a deal breaker. What you've done does not go in back. I cannot forget it or forgive it. They want to say my partner was insanely jealous. It was a slip up and he made a mountain out of a molehill. He's not magnanimous, not empathic enough to forgive me and to understand what had happened in my motivations. This is the breakup triangulation. Restorative triangulation has the exact opposite goal, to revive the relationship by provoking an emotional response in the jilted partner, in the injured partner, in the partner you deceive and you betray. Such triangulation involves the mere favorable mention of another person, hence at possible misconduct or compromising circumstances or at a maximum aggressive flirting and maybe non-penetrative sex acts such as kissing, petting, making out, hugging or oral sex. Triangulation is a last resort. It's a risky strategy. It often escalates counter-productively into sexual assault by the recruited third party. It sometimes results in extreme reaction by the offended partner who chooses to discard an unfaithful, disrespectful, narcissistic and disempathic counterparty. So it's a Russian relate. It's a game that can end badly. Triangulation, using a third party to provoke jealousy in, gather attention from or punish one's intimate partner, very often goes awry and ends badly. The third party, as I mentioned, can sexually assault the triangulator or the targeted intimate partner can walk away from the whole manipulative scene, et cetera, et cetera. These are outcomes. These are adverse outcomes that few triangulators consider because most of them have problems with impulse control. Many of them are borderlines and they act out. It's a kind of psychopathic state. I don't care about the consequences. I'm not thinking about my partner. I have my needs. I want it now. There's only a tunnel vision.  It's all about the here and now. It's malignant mindfulness. Most triangulators are impulsive. Most triangulators are defined. Actually, it's good reason to believe that serial cheaters, habitual cheaters and triangulators, habitual triangulators are probably subclinical psychopaths. Many of them have unrestricted social sexuality. They have no problem to sleep with strangers. They externalize their own dysregulated negative emotions, which often overwhelm them. Their thinking is short-term. Their empathy is gone. And so they often, they're often shocked by the consequences of their own misbehavior. I don't know, being raped by a nice guy, break up with a spouse or boyfriend, girlfriend, pain they had inflicted, which went way beyond what they had intended. Things especially cascade and escalate out of control if all the parties involved are immature and narcissistic, callous and exploitative. What starts as a mere flirtation ends up being a deleterious power play to the point of no return for everyone involved. Don't think you can control this dynamic. It's out of your hands the minute you misbehave. When it comes to sexual assault, for example, they're not safe men. On the contrary, most sexual transgressions are committed by male friends or brothers or colleagues or acquaintances. This is because men misinterpret all female behavior as sexually inviting. This is called the sexual over-perception bias. All men respond aggressively to teasing, overt flirting and signaling with no continuation. All men use sex to communicate, to comfort, to console, to protect, to commiserate, to hold. And all men are preoccupied with possessing the woman and competing with other men, often poaching her from her boyfriend or husband. These are all dynamics that can go awry. But coming back full circle, when one or both parties are mentally ill, none of this matters. None of this matters. They just go about hurting each other, damaging and injuring each other, trying to provoke the other to love dysfunctionally by causing pain, because love is pain, and pain is control, and control is guarantee against abandonment. And so these men and women go around, cheat multiply, triangulate with many other people, treating them as instruments and objects, end up in hairy situations, end up destroying each other, and yet can't let go, trauma bonding. They just can't let go. And in their wake, there is a trail of people who have been equally hurt by these many affairs and flings and one-night stands, people who are instruments and tools in the game of chess between the cheater and his or her primary pop. They are poems.


Ahoy-hoy and welcome to the video. I'm Dr. Sumerian, not a real doctor, and today we are going to talk about the dankest memes from the r slash dank memes from site 19 subreddit. Okay, let's get started. My hair looks ridiculous. I did the thing where you take a shower and go to bed before it's completely dry, so it's a little, little frizzy and all over the place. Me, iconic SCP lines. We must declare human death a Keeter SCP. Remember us.  Hold on, is that in the first 30 seconds? Let's take a look. No, no, no. Okay, we're good, I think. You can't have hard curse words in the first 30 seconds of a video. Are you sure not supposed to for advertising reasons?  Shove. Did you know world renowned author Stephen King was once hit by a car? Just something to consider. That one's my favorite. I want to be honest with you. I don't know with 100% certainty if I've actually read the article that's from. I can't name the numbers of the other ones. Remember us?  We'll talk about that in just a second, but they were disgusting. We must declare human death a Keeter SCP. That's a very loud truck. That's not an SCP. That was just a very loud truck. But did you know the Stephen King line, which I've seen quoted many, many, many times. I know someone linked me the SCP it was from at one point when I asked, but I don't think I read it. Or if I, oh well. One thing about this that actually stuck out to me is that I still don't really think, and I'm, you know, maybe I'm wrong. Obviously this person thinks otherwise. I don't really think I've written anything iconic, but then, you know, iconic SCP lines.  That does, if I say that, almost everyone knows exactly what I'm talking about. So that is nice.   But yeah, okay, maybe they do have an iconic SCP. I don't know. Got 119 articles. I know I only know the exact number because I checked very, very, very recently. 119 articles and I just don't feel like any of them are iconic, but maybe I did. Maybe I got one. I don't know. An anomaly that just wants to live. The GOC, religious GOIs. The GOI whose symbol I don't recognize, but well I do recognize it. I've definitely seen it before, but I can't put a name to it. An anomaly that just wants to live. The decommissioning department. Suplex. I mean, uh, yeah, the SCP foundation, I've, you know, SCP foundation doesn't spend a lot of time decommissioning things, but sometimes you gotta. Sometimes you just gotta. The world is better and safer if you do. The entire nation of Kazakhstan and its people, the David materializing in the modern day. Well, okay, yeah, yeah, I mean, well, though, if we're talking about the SCP where the Davites turn out to be a completely harmless, uh, and somewhat small nation, uh, Kazakhstan's not actually that small. Um, I mean, okay, so here's my thing on that. First of all, I don't think the map, uh, that they give in the thing is actually showing you the full extent of modern day, uh, the David Republic. What was it called? David Stan? Oh man, it's been a while. Regardless, the modern day Davites, uh, I don't think it's showing you the full extent of modern day as much as it's showing you the full extent of previous, but even if so, um, somebody in the comments on this meme, and I wish I knew who it was exactly, um, did say something along the lines of, you know, um, what if it's just Kazakhstan renamed? What if Kazakhstan is the David Empire, but renamed and recontextualized and stuff? But I don't, I said it out loud. I'm thinking about how the history of the Davites is completely different and would lead to, you know, butterfly effect stuff. The whole world would be completely different, like completely different. So the, I mean, it's not just the Kazakhstan would be, uh, seriously affected. It doesn't matter that the Davites are immaterial, uh, in the future, that they fall out of importance and just disappear. If you alter history, everything changes in a serious way. Not just for the people whose history you've changed, but for everyone, everywhere. You get rid of, uh, well Kazakhstan and its people all the way back into history and you replace them with the Davites. The Mongol invasions change. What are their decisions? You know, they're just the decisions of the Mongols and their invasions change. That's a very easy butterfly effect to map out because Davites lived in Central Asia where the Mongol Empire invaded in its initial invasion. So now you have that changed. How will, do they decide to invade Europe at all? Do they actually invade Europe and succeed? You know, what's the, what's the changes to the timeline? That's just a tiny, and that's just one sliver of possible changes. It's, yeah.  So, uh, unfortunately, while this is interesting, I don't know that it's necessarily applicable to this marine while microwaving a slice of cheese in the Sight 19 break room for two minutes after the O5 band and for microwaving his tuna fish sandwiches there.    Um, but a lot of times it's just him having fun. Dr. Sumerian's dickishness never really seems to be for fun. He just seems to be spiteful, and I love that. It's just a, well, I mean, not a personal, uh, not in a personal way, but as a character. I love the fact that, like, deep down, he wants to do the right thing.  And you know why I like that? Because I'm pretty petty, too. I think that's why I like it. SCP-426 is a toaster that can only be referred to in the first person. Impossible. Yeah, not all media is going to follow the SCP Foundation's rules for certain SCPs. You're just going to find, learn to live with that. Me, any who used the word nobody. I, um, I very recently in, um, in chat was thinking about this hilariously. Um, the main reason I included it was for this exact reason. Um, I was really, I was wondering why no one had ever adapted in nobody to be part of that, um, Homeric story where Odysseus, oh God, what's the name of the Cyclops? I don't remember the name of the Cyclops. There's a Cyclops that he has to basically encounter and deal with in, like, the very first adventure, uh, after, uh, gosh, this is getting into the weeds. Odysseus is one of the heroes who has to, after the Trojan War, after they win the Trojan War, they have to go home, uh, but they pissed off Poseidon, so there's a huge problem with it. Um, and this is actually more of pissing off Poseidon, uh, because the Cyclops that he ends up doing, doing dirty is one of Poseidon's, uh, kids. And what happens is, as it goes in, and this guy, this guy, the Cyclops has been eating people and he's, uh, eating, I think he actually successfully eats a couple of, uh, Odysseus's crew members from his ship. And Odysseus, long story short, blinds him. And when asked, uh, who blinded you, he has to say nobody, or is it no one? It's one of those two. It doesn't matter because you can adapt, you can change it slightly and get this story to work, uh, because, uh, Odysseus had introduced himself as nobody, uh, the entire time, never gave the guy his actual name, because even the ancient Greeks knew names have power. Uh, anyway, after, after we get through this long circuitous route to the end of this, I had just been wondering when nobody had ever mixed those two together, it would be hilarious if nobody shows up in an ancient Greek epic. Just saying. I was at the last SCP, so it's okay that I took forever to explain the story of Odysseus and, uh, whatever the name of that Cyclops is. Anyway, that's it. Thank you very much for watching. If you enjoyed, okay. All right, we're okay. If you enjoyed the video, hit the subscribe button and then hit the notification bell next to that, so you're notified when I upload new videos. And then head on over to patreon.com, forward slash D Sumerian and pledge it at any level, like everybody here on the screen already has, including MC Cashmill, who's pledged at $50 and Cinderrikey, who's pledged at $100. It's nice to know that I'm not alone here, and I will see you all again on Tuesday.


Hi, welcome. My name is Dr. Marcy Stone and this is Unit 8, the Influences of Class, Ethnicity and Age of your Consumer Behavior Course. This course has 10 units and Unit 8 is on the Influence of Class, Ethnicity and Age. Here are the Unit 8 learning outcomes. So we have compare how both personal and social conditions influence how we spend our money, identify how a person's desire to make a statement about his social class or the class to which they hope to belong, influences the products they like and dislike, identify how social classes are measured, how social class membership is determined, and the measurement problems that marketing managers must deal with. Why are learning outcomes important? So every learning outcome ties back to your course materials and your content, and this includes your test preparation and also your assessments. Here are the Unit 8 overview topics. So we have personal and social influences, social class influences, and social class measurements. And these are the vocabulary terms that we're going to be discussing in this presentation. Alright, so many things influence what products a consumer may buy. These things include a strong economy, social conditions, social status, social class, and the amount of disposable income a consumer has. The higher the social class, the more money a consumer may spend. Other influences may include cultural, personal, or psychological. And it's important that a marketer understand how these influences affect the buying process. There are also instances that a consumer may buy a product they do not want or need. For example, you may buy wrapping paper from your niece because it's part of a school promotion. It's important from a marketing perspective to consider social conditions and social status as a part of a marketing plan. Okay, so we have we've talked about this a little bit in this course, but we have buying influences and they come from different directions.  And then they also include psychological. So these may be perceived needs or your perception. It might be motivation, what motivates you to buy something. It could be learning about a new product or it might be your beliefs and attitudes. And then we have social influences.  You may also have social status that might influence it and any groups that you belong to. And these could be, they could be like parental groups, they could be religious groups, different groups in your life. And then you have cultural. So this might include culture, might be subcultures. I think one of the examples that I talked about earlier is the Mormon religion or the LDS religion. They also have a subculture of people that are Jewish, but that are also Mormons, so Jewish Mormons. And so their culture may be their religion, but their subculture is the fact that they're Jewish. So any of these things might influence a consumer's buying habits. And then from a marketing perspective, they're all important to think about and review. Okay, so when a consumer moves into a different income bracket, their economic decisions may suddenly change. They may be able to afford a car that they've always wanted. Maybe they can move to a different neighborhood, or maybe they buy a bigger house, or maybe they have more disposable income than they've ever had before. So this type of social class upgrade influences their economic decisions and the consumer buying process. So these influences are also psychological in nature, and they impact the consumer buying process. So when a consumer moves from one social class to another, they may gain, they may also gain a higher confidence level. So also something else to consider in marketing. In the United States, there are several social classes that typically are determined by income. So some consumers may believe that they're part of a middle class than when reviewing income levels for what a middle class family actually needs. So they typically, these consumers are related to that experience. So maybe it's something that their parents did decades ago that took them decades to get up to that higher income level. And they may still associate themselves, even though they haven't young children, they may say, I'm middle class. And so it's something to consider because there are quite a few people who believe that they are, but then when they see the breakdown and it changes every year, but when they see the breakdown of what their social class actually is, they may not be middle class, but in their mind they are because that's what their parents were. So it's an interesting thing. And so it can be confusing in marketing because you have to take into consideration, it is what they believe. Cultural diversity is another social factor that should be considered in any marketing plan. And when you're analyzing consumers from diverse backgrounds and cultures, it may also be important to consider social classes when you're focusing on a specific target market. Okay, so here's a little chart of how people kind of self identify themselves. But again, it's kind of reality when it sits in. I remember teaching a class once where we had a listing of what the social classes were. So for a family of four, it had your income needs to be between this level and this level. And when I asked the whole class, which there were about 40 students in the class, I said, what class do you guys think you belong?  Everybody in the class raised their hand. And I'm like, well, I can't be possible. And so then we flipped to that page in the textbook where it literally broke down. Like if you're in the upper class, you're making this much for a family of four. If you are in the middle class, then this is what you're making. And it was really interesting to see their faces. Whoa. Yeah, we're not making that. And when we came to the realization that a lot of them said, even though I'm an adult and I'm in my thirties or forties, I still think that I'm part of my parents' social class. But now that I think about it, it took them decades for them to get to that level. And so it's interesting. But when we see, and this one is very clearly, this is self-identified. So 50% of the people that they surveyed in this believed that they are middle class. But there's also a lower middle class. There's an upper middle class. And then you have your upper class, your 1% people in there. But it is important in marketing to really consider the fact that what class people think that they're related to isn't, it may not be. They may be in a lower class. They may actually be lower middle class or even a lower class and are not sure. It is something to consider. It's extremely interesting, actually. Okay, so in conclusion, here are the unit eight learning income outcomes, after we're talking about income. So compare how both personal and social conditions influence how we spend our money. Identify how a person's desire to make a statement about his social class or the class to which they hope to belong influences the products that they might like or dislike. And then we looked at how social classes are measured, how social class membership is determined, and the measurement problems that marketing managers have to deal with. What's next? So unit nine is on cultural influences. So my name is Dr. Marcy Stone, and I just wanted to say thanks for listening.


My name is Shubhi Panaker. I'm a software engineer working on the web platform in Chrome. And I'm Jason Miller. I'm a DevRel for Chrome. Our talk today is about a key strategy for runtime performance of web apps, and that is scheduling of JavaScript on the main thread, as well as approaches for moving script off the main thread. Jason and I have both been deep in this space, exploring gaps and APIs for what we are calling achieving responsiveness guarantees. We're excited about the opportunity here, both with existing primitives, as well as the new APIs we will show in our talk. Right. So to get started, let's illustrate this problem of space using a demo. So this is a simple application that searches through photos as you type. And you can see here with this JavaScript-controlled red spinner animation, it's doing a fair amount of blocking work on the main thread. And while this is happening, the app can't respond to input, so typing gets queued. Looking closer, what we see if we pulled out the profile or something like this, a sequence of long tasks that block the main thread and cause that input queuing. We can see this on a simplified view here. So if we receive input and we start doing some processing in response to that input, say, searching photos, rendering some list items, we're skipping frames already. But in addition to that, if we receive additional input while that task is running, it will get queued, and it only is able to execute once that has completed. So this is data captured from real users on real websites in the wild. It shows a breakdown of where Chrome was spending its time while handling input. So there's a lot of interesting data here, but we don't really have time to get into it. The main thing to look at is the amount of time that we're spending in this v8.execute task. That is Chrome running JavaScript during touch handling. And it's clearly the biggest contributor to touch input latency, both on average and also in the worst case. So a problem with our search-as-you-type example app is that there's just a lot of different types of work happening here. And all of these different work have what we are calling grade deadlines. So for example, the user is typing in that search box. Their input has to be responsive. There's ongoing animations on the page. They have to render consistently and smoothly. And then there's the heavy lifting of fetching search results, post-processing, preparing, rendering these search results in time so that it's relevant to the user's typed inquiry. The difficulty is that it's hard for apps to balance these competing needs, to reason about all these different deadlines and keeping everything meeting these timelines. Right, so we have a bunch of different types of work, and each of those types of work has a different deadline. And what we need to be able to sort of work through this is priorities. So there's a couple high-level approaches to try and achieve responsiveness guarantees. The first approach can just be doing less work. And there are ways of doing this, such as in an infinite feed, you might only render what's visible. We just saw a strategy with a virtual scroller talk right now. Now, this is not always possible. Modern apps often just have a ton of work to do. So a second strategy here is chunking up work and prioritizing these chunks of work. In practice, though, this is also very difficult. It can be impractical to achieve this manually on your own as an app developer. And we think there's a real opportunity here for frameworks to step in and help their users. Frameworks are in a great position to ensure chunking and prioritizing of work. So stepping back a bit, what we need here is some way to provide our chunks of work, our tasks, to a system that can hold them, say, in a task queue. And then this system can make good decisions about when to take tasks out of the task queue and execute them at an appropriate time, based on everything that's going on. And this is the definition of a scheduler. So Google Maps is a really great example of an application that uses a scheduler to keep its interactions smooth. This app has to manage multiple different types of interactions and events. And this can all happen concurrently. They do this by scheduling all work and giving a much higher priority to input response tasks. We can see that here. So let's say I'm panning the map. And as I'm panning, additional tiles are coming into the viewport and need to be loaded. However, if I stop panning and I pull up the drawer at the bottom, all of a sudden that is far and away the most high priority task to execute. So those map tiles being loaded need to be deprioritized. So a key aspect of a good scheduler is its ability to execute work at the best time. And this is an appropriate time based on everything that's going on, various factors like what's the type of the task, what's important to the user right now, what's the overall state of the application, what's the internal state of the browser, et cetera. So to understand this notion of best time, we have to kind of step down a level and look at the browser's rendering pipeline. The browser is periodically pumping frames, typically every 16 milliseconds for 60 frames per second display rate. And each frame has a set of things that happen in sequence. For instance, we have request animation frames, followed by style, layout, and paint. In Chrome, input handlers are aligned right before request animation frame callbacks. So the point here is that there is limited time to do the urgent work that needs to happen in the current frame. And then the app has to immediately start thinking about preparing for that next frame. And the third type of work here is idle work, which might be left over in the current frame, or there might be plenty of idle time if no frames are being rendered. So this is the terminology we are using for these three types of work. We have user blocking tasks for the current frame. This is typically to provide the user an immediate acknowledgment of what they're doing. So in our example app, this might be keeping that typing interactive in the search box, keeping those animations going on the page overall, keeping the page responsive overall. Buttons should be toggleable. Default work is this next category of work. This is typically user-visible. And this is preparing for the next frame or a future frame. And in our example, this would be the work of the post-processing, preparing the search results, rendering them in time. And finally, the third category, idle work. This is typically work that is not user-visible. This can be at the end of the frame, or if no frames are being rendered, things like analytics, backups, syncs, or indexing. So on the right here, we've sort of listed some existing primitives, existing ways how a developer might be able to submit work to the browser to target these priority levels. So for user-blocking, input handler, and request, and information frames are great for this. It's also worth noting that micro-tests are suited for user-blocking urgent work. They do not yield to the event loop. And we've seen some bad cases where developers are accidentally doing non-urgent or large amounts of work without realizing it's blocking rendering. The second thing, default, we have things like set time out zero post-message. These are really hacks and workarounds. There isn't a real primitive here, and we are working to fill this gap. And finally, for idle, request-idle callback is a great API. So JavaScript schedulers can be built today using these primitives. Now, while it's possible to build a scheduling system in JavaScript, they suffer from gaps, primarily because they don't have enough control on signals to properly control scheduling. So we'll go through some examples. So for example, we've seen JavaScript schedulers are trying to estimate the frame deadline. So they're doing a whole bunch of bookkeeping, trying to guess at it. But they're doing it poorly, because it's just not possible to do this well without knowing browser internals. So we're considering exposing an API for that. Is input pending is a really useful signal for schedulers? And we are actively exploring an API. Then there's other coordination work. So for example, handling fetch response priorities is pretty relevant. If you're doing urgent work for the current frame, you don't want your low priority fetch responses to come in and interrupt that. In practice, though, there's a lot of other work that's happening in the browser. The browser might initiate various callbacks, such as ready state change for XHR, or a post message might come in from a worker. There's internal work, like GC-ing. And it's just not possible to codify priorities for all of this and expose signals. So this got us thinking, how about moving the scheduler one level down and integrating it directly with the browser's event loop, where we already have most of these signals and a lot of great information. And this would solve an additional problem. That is this coordination problem between multiple parties in the app. If you have third party content, or embedded libraries, or legacy code, or even other frameworks, they can all coexist and use the same scheduling system with consistent priorities. So this is a very early sketch of what an API might look like. The key thing here is a set of global task use targeting each priority level. And so this is really simple and straightforward compared to using a myriad of different APIs. The second thing is we think it would be useful to have a notion of user-defined task use, or virtual task use. And this would give developers more control over managing a group of tasks and doing bulk operations, like updating priority, canceling all the tasks, or flushing the task use if the app is going away. So here we can see a simplified version of that map scheduler that we looked at using this task queue API. So first we hook into the user blocking and default task queues just to give ourselves a high and a low priority queue. And then we start listening for pointer moves events. And each time we receive one of these events, we enqueue a pan task with the coordinates of that pointer move. The pan task translates the map tiles, obviously. And then it might, let's say, enqueue a low priority task to detect any tiles that have moved into the viewport and potentially load those tiles. The thing to note here is, if we receive a new pointer move event before we've invoked this load more tiles task, that would be given a higher priority than loading more tiles. And that's exactly what we want. We give higher priority to input-driven tasks. And let's say the team behind maps needed to track analytics or do something in response to pan gestures, that would be a good case for something like an idle priority task. So here you can see most of the frames are in green and getting rendered in time. And this is what a well-scheduled system looks like. The work is chunked up. There is high priority work happening at the beginning of every frame, followed by style layout paint in purple and green, just immediately followed by default priority work in yellow to prepare for the next frame, as well as idle priority work being properly interleaved. And this time is adequately utilized. Next. So all the API proposals we showed today are super early stage. We actually don't know what the end game here is going to be. This is a really great time to give us feedback and help us chart the course here. For web developers, we really think that there is an opportunity here with improved scheduling, even with just properly using existing primitives. For framework authors, we want to urge you to consider a scheduling system and collaborate with us now to develop the right set of APIs in this space. React's work on concurrent and time slicing has proven that frameworks can really play a good role in terms of helping apps improve responsiveness of apps. And so we're already working with React and actively looking to form partnerships with other frameworks and apps. This is a link to our GitHub repo. Filing issues on the repo is a great way to get that feedback dialogue going. Right. So what about work that can't be chunked, though? What if we have a bunch of JavaScript we need to execute and it's really difficult or even potentially impossible to break that work up? Here's an example that illustrates what I mean. Let's say we have a text editor that does something like live JavaScript bundling as you type. If I load in a decent amount of code here, things start to get a little bit slow. So every time the bundling process kicks in in response to my input, it blocks the main thread. And this causes the cursor to freeze and it queues up my text input until bundling is completed. And this really disrupts the typing experience. You can see that in the CPU profile here on the right. So it would be really difficult to break that work up into 50 millisecond chunks. And that's for two reasons. First, I didn't write any of the bundler code. So modifying that would be a lot of work, particularly for me. Plus, there is a whole bunch of different libraries that are being used to actually make these things happen, those dependencies, and downloading, parsing, and evaluating those dependencies on the main thread blocks. So using background threads lets us offload that work and get it off the main thread so the main thread can sort of just keep handling input. There's a few use cases that lend themselves extremely well to this approach. If you're building a computer-aided design tool, a game, or doing encoding, these are great places to just start with threads. Same thing for AI, machine learning, crypto. If these are the types of things you're doing, you should start here. In the browser, our primitive for threading is the worker. So if you haven't used workers, you haven't used them in a while, they're basically threads. They have a simple messaging interface, so you can send a message to the worker and you can receive a message back. They have no DOM access whatsoever and a very limited global scope, kind of just fetch and modules stuff. And they shipped around 10 years ago and they're available essentially everywhere. So the API for workers looks like this. You will instantiate the worker constructor and pass it the name of a script, and then we can listen for messages coming back out of that worker and we can send messages down to the worker. So here, we're sending in a message that's an object and this describes that we would like to say, invoke a compute hash function and we're going to pass it the contents of a file expressed here as an array buffer. The second argument to post message is interesting. This tells the browser to, rather than structured cloning the array buffer, it will transfer it in. Finally, once compute hash has completed, it will say post message back to our thread and will be dropped into the message handler on line three. So under the covers, this post message of the data is incurring a serialization on the main thread since getting queued up, hopping over to a worker thread followed by de-serialization. And end to end, this is called a thread hop. And this thread hop has a cost and primarily from the data being subject to what is called structured cloning, which is a copying behavior while recursing the JavaScript object, the size of the data is relevant to the cost of the thread hop. So one downside of the post message API is that it doesn't have a notion of statefulness between the request and the response.  Right, so we've seen how to communicate with a worker using post message. There's actually a number of ways you can do this. A second way would be to use message channel. Message channel is something you can instantiate and you get back two ports. You can pass your other port to some other contexts like a tab or a frame or a worker and you can message between the two. They have the same interface as we just saw. Another one would be broadcast channel. This is sort of like a message channel that's shared to all contexts associated with an origin. So all tabs, frames, workers, service worker. And all you do is you instantiate a broadcast channel with a channel keyword and you can message without having to pass ports around. Soon we're actually going to have a fourth way to communicate and this is transferable streams. It lends itself really well to things like audio and video where the format you would want to use to express these things is streaming. The thing with all of these APIs is that they're message-based. And based on some of the common usage patterns that we've seen and what we've heard from developers, we think there might be a case here for a higher level API. So we've seen solutions to this in user land through libraries like comlink, greenlit, workerize, via.js. These all help coordinate messaging across boundaries by abstracting that post message using something called proxying. So messaging certainly improves over a post message. I'm sorry, proxying improves over a post message, but it comes with a number of downsides. Every method called to a proxied object incurs this cost of a thread hop and this can come as a surprise to developers. Platform gaps can cause memory leaks in these APIs. They don't, these APIs don't really have a notion of a backing thread pool or a concept of managing threads and resizing the pool. Embedded libraries are not able to share the same thread or thread pool. And for complex APIs, it can be impractical to recreate this API surface cross thread. So this raises the question, is there an opportunity here for better integration with the browser? Is there an opportunity to provide a more compelling API? Right. So this, we think there might be a use case here for something that looks something like this. So here we're passing the name of a function in some other context and some arguments to a theoretical post task method. This post task method would return a promise that eventually resolves to the return value of that function somewhere else. This abstract code helps us move from a message passing model to a more task oriented model. So in looking at the requirements for a better API, we considered other platforms. We looked at iOS and Android, which have plenty of precedent for usage of background threads. In particular, iOS has an API called Grand Central Dispatch, which is a very stable, well proven API that's loved by iOS developers. Android, amongst other things, has something called Async Task, which is a very minimal clean API. We talked to framework developers and experts in usage of these APIs who are deeply familiar with the pitfalls and we learned things. Some key things we learned in terms of the basic requirements we want for our model is number one, good ergonomics, a way for developers to offload work by just thinking in terms of submitting tasks versus coordinating over threads. Secondly, a native thread pool that's shareable with embedded libraries and other parties in the app. And finally, system controlled thread management, where the system can be in control of making decisions on resizing the thread pool or decisions on where to run which tasks. So we set off on a path towards building a basic task queue-based API, inspired by Grand Central Dispatch, and a naive API might look like this. Let's say we have three tasks, A, B, and C, and let's say each one depends on the results of the previous task, and we can submit these tasks from the main thread over to worker threads and then we'll start getting responses back. So here for three tasks, we paid the cost of six thread hops. There's a few downsides here in gotchas. So for one, these thread hops can be expensive on lower end devices, and depending on the data size, it can be up to 15 milliseconds. And this can add up. This means that if these hops are in the path of user interaction, this can add up to multiple frames worth of latency now. On Android, we've actually seen this in practice in the real world in their usage of async task. So one conclusion here is this notion of default posting back results to the main thread is not a good idea. Besides the latency issue, it can cause congestion from queue buildups, and then you might remember from our earlier main thread scheduling talk, we're doing all this work to carefully chunk up our work and execute our high priority and our default priority work, and all these post messages coming in at random times messes with main thread scheduling. A second thing to note here is that default posting even to the current thread can be pretty bad. And we saw this in ground central dispatch with their dispatch get current queue API. Right, so this brings us to a new proposal we have that incorporates some of our learnings from other platforms. It lets developers avoid sending data back to the main thread. It lets you chain tasks together without data transfer and pay the return cost only once. It also minimizes thread hops using a built-in sticky thread pool. What we want is the experience that you see up here on the right. So let's dive into that. If we revisit the code editor that we showed earlier, the one that bundles JavaScript as you type, if we do this using task worklet, we can leverage some of these features to improve performance fairly considerably. Because task worklet avoids transferring data between threads, the bundling and minifying tasks in this demo can actually all reuse the same AST that is generated from that initial parse task. In the end, only the resulting minified code, which is a relatively small string, actually gets sent back to the main thread. So the implementation looks something like this. First, we create a worklet module and that registers named task processors. It just classes with a process method. Then over on the main thread, we can coordinate that data flow using this post task. So we're gonna parse the code and then pass that resulting AST through the bundle and minify tasks. And the important thing to know here is that none of these variables are actually holding values. These are just pointers to data that exists in the thread pool. Data transfer back to the main thread only happens when we await the result property of that last task. So doing this in a typical worker's implementation would normally take six hops as we saw. We executed three tasks. We need to pass a message down and back up for each of them. In task worklet, this is only two thread hops because we can transfer data between tasks. Task worklet is also backed by a thread pool. So let's say we start off with a task that produces a large set of images. When we post a task with some of those images as its argument, it will attempt to run in the thread where that data is already available. So data is never transferred between threads in this case and that leads to fewer thread hops. To take advantage of pooling though, if there's no optimal thread available, we will resort to transferring data between threads in order to get parallelization. And then finally, let's say the result that we're looking for here is actually just a comparison of the number of cats versus the number of dog photos since that's what's important in the end. In this case, the only thing we ever transfer back to the main thread is a single integer. And as you can imagine, that's extremely cheap. So we've been thinking a lot about what the future of web development off the main thread might look like. Today, we have libraries like comlink that use reflection to kind of emulate the interface of some code running in a worker so that it could be called from the main thread seamlessly. In the future, we think we might move towards a task worklet model where developers approach multi-threaded web programming in sort of a different way. You have a thread pool that's managed automatically, named tasks, and this concept of a task graph that optimizes execution and data flow. So this is a really early proposal. We are looking for feedback and we are looking for real-world use cases. There's an implementation available in Chromium behind the experimental web platform features flag. And also we have a polyfill and some source code and demos available at this GitHub repo. There'll be a link at the end of the presentation as well. So there's been a lot of interest in this idea of multi-threaded JavaScript over the last couple years. There have been several independent explorations by various frameworks and apps. So we dug into this in the last few months to understand how far can we get with just using the worker API as a way to achieve threadedness. And to set some context here, a new worker doesn't just spin up a raw OS thread. It actually creates its own JavaScript environment on top of this. And part of that is what's called a V8 isolate, which has a non-trivial weight in addition to the weight of the OS thread. A key implication here is that the worker, by creating its own JavaScript environment, is not able to share data or code with the main thread. And this is fundamentally different from background threads on other platforms and other languages. So this has implications in terms of using workers in a mainstream way. And by that, I mean when the worker is in the path of user interaction. In particular, we looked at two app development models using worker. The first one is doing state management in a worker. And this is where you can do sort of the heavy lifting business logic-y stuff in a worker. And the second model goes even further and does the bulk of rendering in the worker. Now, while worker doesn't have access to the DOM, there are libraries like worker DOM so you can do virtual DOM updates in the worker and then ferry the diffs back to the main thread. So real apps have been built using these models. However, there are some significant challenges that we wanna sort of highlight here if you're planning to go down this route. The first thing is that it's hard to have synchronous access from to a worker, but real apps need synchronous access to their app state. So what this means is sometimes you wanna look up your app state on the main thread and sometimes you might update that app state on a worker. And this means you now have to maintain and replicate this app state in both places and synchronize it continuously. And this has a cost in terms of thread hops. The second thing here is that the worker has to be bootstrapped with all the script and modules that it needs. Because like we said, it cannot share code with the main thread and this has implications for startup delay. So we run benchmarks and to kind of dig into this base cost of a worker and these are some numbers from a medium Android device. Startup takes upwards of 10 millisecond. This is again a Chrome on Android. A thread hop varies anywhere from one to 15 milliseconds depending on the device and the size and type of the data. Look out for a blog post that will be accompanying this talk in the next week or two and we will have some detailed links to our benchmarks and data there. We also set up more realistic benchmarks. These were, we built apps that were representing the app development models we mentioned that is the state management in a worker and rendering in a worker. And we did a ton of runs on real mobile devices both with and without worker. And we looked at a variety of metrics. Everything from loading metrics, memory metrics to rendering metrics such as frame rate and input latency. And we approximated input latency using cycle time. So again, the blog post will have more details on this. But I do wanna highlight one bit of interesting data. So this is basically showing runs with an app that is representative of rendering in a worker. The red runs with worker and blue is runs without worker. So what we are seeing here is that on worker, we are seeing a higher, more improved frame rate. But on the flip side, we are also seeing a higher input latency. So there's a fundamental trade-off here between improved smoothness versus user latency. Workers are able to sort of free up the main thread by offloading work. And so they can sort of free up that main thread to focus on rendering. And fewer, less grip means fewer long task hiccups on the main thread. Again, on the flip side, input latency suffers from thread hops. And the worker environment is a limited environment and doesn't have APIs. And it's not just the DOM. There are many other APIs that are still not available like media, audio, et cetera. So the key thing to take away from this is workers might be able to make your rendering smoother, but they might do it at the expense of a bit of input delay. There's cases though where this is completely worth it. So AMP Script is a great example. AMP Script renders using workers in order to sandbox potentially misbehaving JavaScript. Slower or problematic code that's running in the worker in this emulated DOM can't negatively impact the AMP document. And so for AMP, the benefits they get out of sandboxing untrusted code far outweigh the latency that they get from transferring events. So we wanted to summarize when to use workers, but it turns out there's no perfect rubric for this. So there's a couple of hints you can use though. If you have code that blocks for a long time, if you have code with small inputs and outputs, or something that follows the simple request response model, you might be in a position to start off with workers. However, if you have code that relies on the DOM or is directly in the path of input response, or just code that needs really minimal overhead, you might want to start off with a different solution. You could approach workers later. When adopting a threaded approach to state management, make sure that your state management and business logic outweighs the cost of creating a worker and sending and receiving messages. Make sure that your worker is pulling its own weight. So we're at the beginning of a fairly major shift in how applications are developed for the web. We're excited to explore new possibilities for effective scheduling and threatening, and we hope that all of you are too. And so we just want to leave you with some of these key messages from our talk today. It's hard to achieve responsiveness guarantees because there's so much work happening in modern apps, and we think scheduling is a compelling strategy for tackling this. There's an opportunity here for improved scheduling with existing primitives as well as new primitives, and frameworks are in a good position to play a big role here. In terms of offloading work from the main thread, you can think of using worker as an extension to better main thread scheduling. Some types of work are better suited to worker than others, and we think new APIs like Task Worklet are going to be compelling to utilize worker for scheduling. So that's about it. We'll have a blog post coming with more details. These are, again, the links to the GitHub repos. Issues on the repos are very welcome and appreciated in a great way for the feedback loop, and do not hesitate to reach out to us on email or Twitter. Thank you.


It is the i2s amplifier BFF. Here you can see I have the i2s amplifier BFF soldered to the backside of a QT Pi RP2040, and then I've just plugged in one of these nice little speakers that have the picoblade connector so you can pull that right off depending on how your setup is is meant to be put together. This is playing three wave files that I have actually all playing at the same time and then I'm just changing their output levels in the mixer, in audio mixer. All happening inside of circuit Python, and they're just looping sounds. And you can see this will work really well for projects that are maybe small props, little enclosures, costume things, sound players, toys, little synthesizers, and the like. So really nice, easy, basically plug-and-play. It is the i2s amplifier BFF for QT Pi and Zhao.


Hello and welcome to this presentation of the STM32 Reset and Clock Controller. The RCC controller integrated inside STM32 products manages system and peripheral clocks. STM32F7 devices embed two internal oscillators, two oscillators for an external crystal or resonator, and three phase locked loops or PLLs. Many peripherals have their own clock, independent of the system clock. The RCC also manages the various resets present in the device. The STM32F7 RCC provides high flexibility in the choice of clock sources, which allows the system designer to meet both power consumption and accuracy requirements. The independent peripheral clocks allow a designer to adjust the system power consumption without impacting the communication board rates. Finally, the RCC provides safe and flexible reset management. Safe and flexible reset management without any need for external components reduces application costs. The RCC manages three types of resets. The system reset, the power reset, and the backup domain reset. The peripherals have individual reset control bits. Here is the simplified block diagram of the system reset. All internal reset sources provide a reset signal on the NRST pin, which can be used to reset other components of the application board. In addition, no external reset circuitry is needed due to the internal glitch filter and the safe power monitoring feature, which guarantees the reset of the application when VDD is below the selected threshold. An internal pull-up on the NRST allows a high level to be maintained when no reset signal is driven low. The first type of reset is the system reset, which resets all the registers except certain registers for the reset and clock controller. It also does not reset the backup domain. The system reset sources are the external reset generated by a low level on the NRST pin, a window watchdog event, an independent watchdog event, a software event through the nested vectored interrupt controller, and a low power mode security reset, which is generated when stop or standby mode is entered, but is prohibited by the option byte configuration. The reset source flag can be found in the RCC control and status register. The second type of reset is the power reset. The brownout reset or BOR resets all registers except those in the backup domain powered by VBAT, which contains the RTC and the external low speed oscillator. When exiting standby mode, all registers powered by the regulator are reset. When exiting standby mode, a reset is generated. The third type of reset is the backup domain reset, which resets the RTC registers, the backup registers, and the RCC backup domain control register. This reset occurs when the BDRST bit is set in the RCC backup domain control register. It also occurs when VDD and VBAT are powered on if both supplies have previously been powered off. The RCC offers a large choice of clock sources, which can be selected depending on low power, accuracy, and performance requirements. STM32F7 devices embed two internal clock sources, a high speed internal 16 MHz RC oscillator, or HSI, and a low speed internal 32 kHz RC oscillator, or LSI. STM32F7 devices embed two oscillators for use with an external crystal or oscillator, a high speed external 4 to 26 MHz oscillator, or HSE, with a clock security system, and a low speed external 32.768 kHz oscillator, or LSE, also with a clock security system. STM32F7 devices embed three phase locked loops, each with three independent outputs for clocking different peripherals at different frequencies. The high speed internal oscillator is a 16 MHz RC oscillator, which provides 1% accuracy and fast wake-up times. The HSI is trimmed during production testing, and can also be user-trimmed. The HSI is selected as clock at wake-up from stop mode, and as the backup clock if an HSE failure is detected by the clock security system. If an HSE failure is detected, the clock security system allows the system to be put in a safe state by generating break events to critical applications such as motor control. The 32.768 kHz low speed external oscillator can be used with external quartz or resonator, or with an external clock source in bypass mode. The oscillator driving capability is programmable. Four modes are available, from ultra low power mode to high driving mode. The LSE can be used to clock the RTC, the low power timer, the HDMI-CEC interface, and the USARTs peripherals. STM32F7 devices embed three phase locked loops, each with three independent outputs. The input clock of the PLL can be selected between HSI and HSE. The main PLL can provide the system clock. The different PLL outputs can be used for the serial audio interfaces, USB, random number generator, SDMMC peripherals, and LTDC and DSI host interfaces when available. The system clock is selected between the HSI, HSE, and PLL output. The maximum system clock frequency is 216 MHz. The APB1 and APB2 bus frequencies are also up to 54 MHz and 108 MHz respectively. The maximum clock source frequency depends on the voltage scaling. The maximum system clock is reached with voltage scale 1 and when enabling overdrive. When overdrive is off, the maximum system clock frequency is 180 MHz. Several peripherals have their own clock, independent from the system clock. This is the case for the USARTs, I2C's, low power timer, HDMI-CEC interface, independent watchdog, USB OTG-HS internal PHY clock, and Ethernet MAC clocks when available in the device package. All of these clocks can be selected from the internal external oscillators, dedicated external clock pin, or bus interface clocks. Serial audio interfaces, USB OTG-FS, random number generator, and SDMMC interfaces have independent clock sources that are generated from the different PLL outputs. In addition to PLL outputs, the serial audio interfaces clock can be generated from external clock mapped on the I2S CKIN pin, or from the HSI HSE clocks if this feature is available. Several peripherals available only on some F7 device part numbers, such as the DFS DM1 interface, the SDMMC2 interface, and the DSI host interface have dedicated input clock sources. The clocks are derived from PLL outputs or from system clocks. In addition to PLL outputs, the DSI host interface clock can be generated from its own PLL. The various clocks can be output on an IO. The microcontroller clock output feature allows you to output on a pin of one of these six clocks. HSI, HSE, LSE, SYS CLK, PLL CLK, and PLL I2S. The dynamic power consumption can be optimized by using peripheral clock gating. Each peripheral clock can be gated on or off in run and sleep mode, except SRAM and FLASH, which are always clocked in run and sleep modes. By default, the peripherals clock is disabled, except the DTC MRAM clock and RTC interface clock, which are enabled by default. When a peripherals clock is disabled, the peripherals registers cannot be read or written. Dedicated registers allow for configuring the peripherals clock during the sleep mode. These control bits have no effect if the corresponding peripheral clock is disabled. This slide lists the RCC interrupts. The PLLs ready and all oscillator's ready signals can generate and interrupt. In addition to this training, you may find the power control and interrupt controller training is useful. For more details, please refer to application note AN2867, an oscillator design guide for STM8S, STM8A, and STM32 microcontrollers.